Skip to content

Commit

Permalink
refactoring app to create new project from scratch with the latest zemit
Browse files Browse the repository at this point in the history
  • Loading branch information
jturbide committed Feb 22, 2024
1 parent c6fdb41 commit 9014eed
Show file tree
Hide file tree
Showing 55 changed files with 434 additions and 301 deletions.
File renamed without changes.
4 changes: 3 additions & 1 deletion .htaccess
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# force public folder
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/index.php?_url=/$1 [QSA,L]
RewriteRule ^$ public/ [QSA,L]
RewriteRule (.*) public/$1 [QSA,L]
</IfModule>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Zemit is using the [Phalcon Framework](https://phalconphp.com). You can use [com
Zemit Core requires multiple PHP extensions. Please use `composer` to make sure that you meet the requirements.

#### Languages & compatibilities
- [PHP](https://www.php.net/) >= 7.4
- [MySQL](https://www.mysql.com/) >= 5.7
- [PHP](https://www.php.net/) >= 8.2
- [MySQL](https://www.mysql.com/) >= 8.0
- [Composer](https://getcomposer.org/download/)
- [NPM](https://www.npmjs.com/get-npm) >= 12.0
- [Angular](https://angular.io/guide/quickstart) >= 9.0
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions app/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# deny access
order deny,allow
deny from all
7 changes: 5 additions & 2 deletions app/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@

namespace App;

use App\Bootstrap\Config;
use App\Config\Config;

class Bootstrap extends \Zemit\Bootstrap
{
public $config = Config::class;
final public function initialize(): void
{
$this->setConfig(new \App\Config\Config());
}
}
53 changes: 0 additions & 53 deletions app/Bootstrap/Config.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/Bootstrap/Router.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/Bootstrap/Services.php

This file was deleted.

65 changes: 65 additions & 0 deletions app/Config/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Config;

use Zemit\Cli\Module as CliModule;
use Zemit\Locale;
use Zemit\Mvc\Module as MvcModule;
use Zemit\Support\Env;

class Config extends \Zemit\Bootstrap\Config
{
public function __construct(array $data = [], bool $insensitive = false)
{
$data = $this->internalMergeAppend([

'app' => [
'version' => '1.0.0'
],

'modules' => [
MvcModule::NAME_API => [
'className' => \App\Modules\Api\Module::class,
'path' => APP_PATH . '/Modules/Api/Module.php',
],
MvcModule::NAME_ADMIN => [
'className' => \App\Modules\Admin\Module::class,
'path' => APP_PATH . '/Modules/Admin/Module.php',
],
MvcModule::NAME_FRONTEND => [
'className' => \App\Modules\Frontend\Module::class,
'path' => APP_PATH . '/Modules/Frontend/Module.php',
],
CliModule::NAME_CLI => [
'className' => \App\Modules\Cli\Module::class,
'path' => APP_PATH . '/Modules/Cli/Module.php',
],
],

'router' => [
'defaults' => [
'namespace' => Env::get('ROUTER_DEFAULT_NAMESPACE', 'App\\Modules\\Frontend\\Controllers'),
'module' => Env::get('ROUTER_DEFAULT_MODULE', MvcModule::NAME_FRONTEND),
],
],

'locale' => [
'default' => Env::get('LOCALE_DEFAULT', 'en'),
'mode' => Env::get('LOCALE_MODE', Locale::MODE_DEFAULT),
'allowed' => explode(',', Env::get('LOCALE_ALLOWED', 'en')),
],

'providers' => [
// add your providers here
],

'models' => [
// override native zemit models with your own
],

'permissions' => [
// add your application acl permissions here
],
], $data);
}
}
Empty file added app/Models/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions app/Modules/Admin/Controllers/AbstractController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Modules\Admin\Controllers;

use Zemit\Modules\Admin\Controller;

abstract class AbstractController extends Controller
{
}
12 changes: 12 additions & 0 deletions app/Modules/Admin/Controllers/ErrorController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Modules\Admin\Controllers;

use Zemit\Mvc\Controller\StatusCode;
use Zemit\Mvc\Controller\Errors;

class ErrorController extends AbstractController
{
use StatusCode;
use Errors;
}
10 changes: 10 additions & 0 deletions app/Modules/Admin/Controllers/IndexController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Modules\Admin\Controllers;

class IndexController extends AbstractController
{
public function indexAction()
{
}
}
13 changes: 13 additions & 0 deletions app/Modules/Admin/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Modules\Admin;

class Module extends \Zemit\Modules\Admin\Module
{
final public function getNamespaces(): array
{
return array_merge([
'App\\Models' => APP_PATH . '/Models/'
], parent::getNamespaces());
}
}
9 changes: 9 additions & 0 deletions app/Modules/Api/Controllers/AbstractController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Modules\Api\Controllers;

use Zemit\Modules\Api\Controller;

abstract class AbstractController extends Controller
{
}
12 changes: 12 additions & 0 deletions app/Modules/Api/Controllers/ErrorController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Modules\Api\Controllers;

use Zemit\Mvc\Controller\StatusCode;
use Zemit\Mvc\Controller\Errors;

class ErrorController extends AbstractController
{
use StatusCode;
use Errors;
}
10 changes: 10 additions & 0 deletions app/Modules/Api/Controllers/IndexController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Modules\Api\Controllers;

class IndexController extends AbstractController
{
public function indexAction()
{
}
}
13 changes: 13 additions & 0 deletions app/Modules/Api/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Modules\Api;

class Module extends \Zemit\Modules\Api\Module
{
final public function getNamespaces(): array
{
return array_merge([
'App\\Models' => APP_PATH . '/Models/'
], parent::getNamespaces());
}
}
12 changes: 0 additions & 12 deletions app/Modules/App/Controller.php

This file was deleted.

13 changes: 0 additions & 13 deletions app/Modules/App/Controllers/AbstractController.php

This file was deleted.

49 changes: 0 additions & 49 deletions app/Modules/App/Controllers/ErrorController.php

This file was deleted.

10 changes: 0 additions & 10 deletions app/Modules/App/Controllers/IndexController.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/Modules/App/Module.php

This file was deleted.

13 changes: 13 additions & 0 deletions app/Modules/Cli/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Modules\Cli;

class Module extends \Zemit\Modules\Cli\Module
{
final public function getNamespaces(): array
{
return array_merge([
'App\\Models' => APP_PATH . '/Models/',
], parent::getNamespaces());
}
}
Loading

0 comments on commit 9014eed

Please sign in to comment.