Boris REPL and you Applicatoin (Silex in this case)

Posted: 2014-08-10 13:34:55

This video will cover the details http://youtu.be/RHdxSsCDmNQ

boris

Just a few notes though https://github.com/d11wtq/boris is a better place for getting started overall.

Borisrc

This lives in the root of my application which includes the startup file for the application.

<?php
#.borisrc

$core = require_once(__DIR__.'/bootstrap/start.php');
$boris = new \Boris\Boris('base_app> ');
$boris->setLocal(array('core' => $core));
$boris->start();

The start.php file I am using for the core startup needed by index.php, this and later a command line class to run the queue daemon and other things

<?php
#bootstrap/start.php
require __DIR__.'/../bootstrap/autoload.php';

$core = new \App\Core();
$core->getApp();

if (file_exists(__DIR__ . '/../.env')) {
    \Dotenv::load(__DIR__.'/../');
}

$paths = include(__DIR__.'/paths.php');

$core->setUpPaths($paths);

$core->setEnv();

$core->setDatabaseConnection();

$core->getApp()->register(new Silex\Provider\MonologServiceProvider(), array(
    'monolog.logfile' =>  $core->getStoragePath() . '/logs/core.log',
));

require_once(__DIR__.'/../custom_start.php');

return $core;

So index.php like .borisrc calls to this

<?php
#public/index.php
$core = require_once __DIR__.'/../bootstrap/start.php';

$core = require_once __DIR__.'/../app/routes.php';

$core->getApp()->run();

At this point, as seen in the video we can interact with the core app and other methods!


Tags:

boris php silex