Phalcon 3 Structures

Hi!

I'm new user Phalcon I switched from Laravel 4-5. I find the best structure for my test project. I want to create something like this

-test
    -backend
        -controllers
        -views
    -frontend
        -controllers
        -views
    -models
    -configs
    -public

And I want domain.com for folder frontend and domain backend.domain.com for folder backend how i can do this? Maybe some one have a git repository for this? At this moment I have difficulties with creating projects for my requirements! Please some one help me



4.8k
edited Aug '17

I think this repository has some nice starting structures/examples in it: https://github.com/phalcon/mvc, more specifically this one: https://github.com/phalcon/mvc/tree/master/multiple/apps

edited Aug '17

>I think think repository has some nice starting structures/examples in it: https://github.com/phalcon/mvc

I saw them. But I think they are too old or not?



4.8k

Its for Phalcon 3.0.x so should not be outdated

I saw some one used config.ini for all configs. Maybe I'm just thinking about creating from the point of view of Laravel



4.8k

It's decoupled, you can basically use whatever suits you best or where you feel more comfortable with. I'm using a PHP array myself instead of a .ini

app/config/config.php

defined('BASE_PATH') || define('BASE_PATH', getenv('BASE_PATH') ?: realpath(dirname(__FILE__) . '/../..'));
defined('APP_PATH') || define('APP_PATH', BASE_PATH . '/app');

return new \Phalcon\Config([
    'database' => [
        'adapter'     => 'Mysql',
        'host'        => 'localhost',
        'username'    => 'root',
        'password'    => '',
        'dbname'      => 'phalcon-time',
        //'charset'     => 'utf8_general_ci',
    ],
    'application' => [
        'appDir'            => APP_PATH . '/',
        'controllersDir'    => APP_PATH . '/controllers/',
        'modelsDir'         => APP_PATH . '/models/',
        'viewsDir'          => APP_PATH . '/views/',
        'pluginsDir'        => APP_PATH . '/plugins/',
        'formsDir'          => APP_PATH . '/forms/',
        'formsElementsDir'  => APP_PATH . '/forms/elements/',
        'vendorDir'         => APP_PATH . '/vendor/',
        'cacheDir'          => BASE_PATH . '/cache/',
        'baseUri'           => '/phalcon-time/',
        'domainUri'         => 'http://localhost:8080/phalcon-time'
    ],
    'settings' => [
        'development'    => TRUE,
    ]
]);