2017 © Pedro Peláez
 

library core

LT Project Core

image

logikostech/core

LT Project Core

  • Monday, September 19, 2016
  • by logikos
  • Repository
  • 1 Watchers
  • 0 Stars
  • 34 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 3 % Grown

The README.md

Core classes required for logikos applications

Travis CI Software License, (*1)

Core for LT projects., (*2)

Logikos\Application\Bootstrap

Basic usage

  // public/index.php

  $basedir = realpath(__DIR__.'/..');
  $appdir  = $basedir.'/app';

  /**
   * Composer
   */
  $composer = $basedir . '/vendor/autoload.php';
  if (file_exists($composer))
    include_once $composer;


  $boot = new Bootstrap([
      'basedir' => $basedir,
      'appdir'  => $appdir,
      'confdir' => $appdir.'/config'
  ]);

  /**
   * get loaded config from Bootstrap, which will auto merge $confdir."/".getenv('APP_ENV').".php"
   */
  $config = Bootstrap::getConfig();

  /**
   * Include services
   */
  $di = require APP_PATH . '/config/services.php';

  echo $boot->getContent();

Logikos\Application\Bootstrap\Modules

If you pass module configuration information to Bootstrap(), either the module definitions or the defaultModule then bootstrap will automaticly try to initialize the modules Bootstrap::initModules(), (*3)

Of course you can always initModules manualy yourself:, (*4)

  $appdir = realpath(__DIR__.'/../app');
  $boot = new Bootstrap($options);
  $boot->initModules(
    [
      'frontend' => [
        'className' => 'Frontend\Module',
        'path'      => $appdir.'/modules/frontend/Module.php'
      ],
      'backend' => [
        'className' => 'Backend\Module',
        'path'      => $appdir.'/modules/backend/Module.php'
      ]
    ],
    [
      'defaultModule' => 'frontend',
      'modulesDir'    => $appdir.'/modules'
    ]
  );
  echo $boot->getContent();

Note that by specifying modulesDir we really would not have needed to define the modules as the class automaticly finds and registers all modules within the modulesDir. Also the default modulesDir is APP_DIR.'/modules' and the default defaultModule is 'frontend' so really $boot->initModules() would work all by itself with no options if the defaults work for your application., (*5)

Module Routeing

By default the Modules class will automaticly register your modles with the router. It uses /controller/action/params for the default module and /modulename/controller/action/params for all non-default modules. You can override this per module however within your ModuleDefinition class, (*6)

class Module implements ModuleDefinitionInterface {
  public static function defineRoutes(DiInterface $di) {
    /* @var $router \Phalcon\Mvc\Router */
    $router  = $di->get('router');
    $default = $router->getDefaults()['module'];

    $router->add("/customroute/foo/:params", array(
        'module' => 'somemodule,
        'controller' => 'index',
        'action' => 'foo',
        'params' => 1
    ))->setName('somemodule_foo');
  }

The Versions

19/09 2016

dev-master

9999999-dev https://github.com/logikostech/core

LT Project Core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todd Empcke

plugin core phalcon logikostech logikos

19/09 2016

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/logikostech/core

LT Project Core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todd Empcke

plugin core phalcon logikostech logikos

08/08 2016

1.0.1

1.0.1.0 https://github.com/logikostech/core

LT Project Core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todd Empcke

plugin core phalcon logikostech logikos

29/06 2016

1.0.0

1.0.0.0 https://github.com/logikostech/core

LT Project Core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Todd Empcke

plugin core phalcon logikostech logikos