PHP code example of logikostech / core

1. Go to this page and download the library: Download logikostech/core 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/ */

    

logikostech / core example snippets


  // 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 = 

  $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();

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');
  }