PHP code example of mamuz / phalcon-application

1. Go to this page and download the library: Download mamuz/phalcon-application library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mamuz / phalcon-application example snippets


$config = [
    'dispatcher' => [
        // define class namespace identifier of your controllers
        'controllerDefaultNamespace' => 'Rest\Controller',
    ],
    'routes' => [
        // see Router::add in https://docs.phalconphp.com/en/latest/reference/routing.html
        'default' => [
            'pattern'     => '/:controller/:action',
            'paths'       => ['controller' => 1, 'action' => 2], // Optional
            'httpMethods' => ['GET'], // Optional
            'position'    => 1, // Optional
        ],
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)

$config = [
    'dispatcher' => [
        // define class namespace identifier of your controllers
        'controllerDefaultNamespace' => 'Mvc\Controller',
    ],
    'routes' => [
        // see Router::add in https://docs.phalconphp.com/en/latest/reference/routing.html
        'default' => [
            'pattern'     => '/:controller/:action',
            'paths'       => ['controller' => 1, 'action' => 2], // Optional
            'httpMethods' => ['GET'], // Optional
            'position'    => 1, // Optional
        ],
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
    // declare the basepath for the view templates, which enables Phalcon's view engine
    'view' => [
        'templatePath' => './view',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)

$config = [
    'dispatcher' => [
        // define class namespace identifier of your tasks
        'taskDefaultNamespace' => 'Command\Task',
    ],
    // register custom service factories implementing the InjectableInterface
    // see: https://github.com/mamuz/phalcon-application/blob/master/src/Application/Service/InjectableInterface.php
    // Key is the name to refer to Phalcon's DI, value is the FQCN of the related service factory
    'services' => [
        'user'   => 'User\Service\Factory',
        'logger' => 'Logger\Service\Factory',
    ],
];

// make everything relative to the application root
chdir(dirname(__DIR__));

// Composer Autoloader (see: https://getcomposer.org/doc/01-basic-usage.md#autoloading)
sh
$ php index.php mailing send reminder
sh
$ php index.php mailing send reminder [email protected] [email protected]