2017 © Pedro Peláez
 

library boilerplate-slim

Boilerplate for Slim applications

image

fuegas/boilerplate-slim

Boilerplate for Slim applications

  • Sunday, January 31, 2016
  • by Fuegas
  • Repository
  • 0 Watchers
  • 0 Stars
  • 24 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Boilerplate for Slim applications

Environment

You can get the environment the application is running in using the Environment class. The default environment variable that is requested is SLIM_ENV. If you want to use a different variable you can specify it when requesting the environment value:, (*1)

Environment::env() // Returns SLIM_ENV value or default (null)
Environment::env('MY_ENV') // Returns MY_ENV value or default (null)
Environment::env('MY_ENV', 'production') // Returns MY_ENV value or default ('production')

Logger

The boilerplate has Monolog as a dependency. It can be injected into Slim during instantiation., (*2)

By default the logger will be injected with the following values:, (*3)

array(
  'name' => 'SlimMonoLogger',
  'handlers' => array(
    new \Monolog\Handler\StreamHandler('./logs/'.date('y-m-d').'.log'),
  ),
  'processors' => array(),
)

If you want to use stdout as logger, use the following instance call:, (*4)

Log::getInstance([
  'name' => 'YourLogger',
  'handlers' => [ new \Monolog\Handler\StreamHandler('php://stdout') ]
]);

For other logging capabilities, please take a look at: https://github.com/Seldaek/monolog, (*5)

If you want to inject the logger into Slim yourself see the following example:, (*6)

$app = new \Slim\Slim(array(
  'log.writer' => new Ssllii\Helpers\Log(array(
    'name' => 'SlimMonoLogger',
    'handlers' => array(
      new \Monolog\Handler\StreamHandler('./logs/'.date('Y-m-d').'.log'),
    ),
    'processors' => array(
      function ($record) {
        $record['extra']['dummy'] = 'Hello world!';
        return $record;
      },
    ),
  ))
));

The Versions

31/01 2016

dev-develop

dev-develop https://bitbucket.org/fuegas/boilerplate-slim

Boilerplate for Slim applications

  Sources   Download

proprietary

The Requires

 

The Development Requires

php boilerplate slim

31/01 2016

dev-master

9999999-dev https://bitbucket.org/fuegas/boilerplate-slim

Boilerplate for Slim applications

  Sources   Download

proprietary

The Requires

 

The Development Requires

php boilerplate slim

31/01 2016

0.1.4

0.1.4.0 https://bitbucket.org/fuegas/boilerplate-slim

Boilerplate for Slim applications

  Sources   Download

proprietary

The Requires

 

The Development Requires

php boilerplate slim

18/09 2015

0.1.3

0.1.3.0 https://bitbucket.org/fuegas/boilerplate-slim

Boilerplate for Slim applications

  Sources   Download

proprietary

The Requires

 

The Development Requires

php boilerplate slim

16/09 2015

0.1.2

0.1.2.0 https://bitbucket.org/fuegas/boilerplate-slim

Boilerplate for Slim applications

  Sources   Download

proprietary

The Requires

 

The Development Requires

php boilerplate slim

16/09 2015