2017 © Pedro PelĂĄez
 

project slim2-skeleton

A Slim Framework 2 application skeleton

image

aurmil/slim2-skeleton

A Slim Framework 2 application skeleton

  • Thursday, March 24, 2016
  • by aurmil
  • Repository
  • 1 Watchers
  • 1 Stars
  • 140 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 11 % Grown

The README.md

Slim 2 Skeleton

What's included?

  • Slim v2
  • Twig v1
  • Monolog v1
  • Symfony Yaml Component v3

Installation

Required: Composer, (*1)

Run the following command, replacing [your-project-name] with the name of the folder you want to create., (*2)

composer create-project aurmil/slim2-skeleton [your-project-name]
  • Create a virtual host that points to your project path /public
  • For Apache, make sure it has AllowOverride All for Slim URL rewriting
  • Make sure var folder is writable by Web server

Web server choice

This skeleton includes a .htaccess file for Apache., (*3)

Feel free to read the Slim documentation if your prefer to use another Web server like nginx., (*4)

Configuration

Application configuration is stored in /app/config.yml which is divided into 2 main parts: general settings and environment-specific settings., (*5)

Environment settings are grouped within sections. A section = an environment. Section name = value of ENVIRONMENT env variable (default = development)., (*6)

General settings are merged with environment-specific settings. The latter ones overwrite the first ones., (*7)

Access config in PHP code

In /app/src/bootstrap.php, the whole configuration is in the $config variable., (*8)

In a controller action, only the App section of configuration is available through $app->config('app')., (*9)

$tmp = $app->config('app')['my_custom_setting_key'];

Access config in Twig template

Only the App section of configuration is in the config variable., (*10)

{{ config.my_custom_setting_key }}

Application errors by email

By configuring App.errors.send_email and App.errors.email, you can enable or disable sending email with Monolog when an error occurs., (*11)

Meta tags

Every key: value pair you add under App.metas will be output in HTML head section as a meta tag., (*12)

Title

Page title is a special case. Obviously, title and title_separator entries won't be output as meta tags like the other ones., (*13)

A page title is formed as follows: * content of the metaTitle block a template child could define, (*14)

{% block metaTitle %}my custom page title{% endblock %}
  • if App.metas.title is not empty:
    • if App.metas.title_separator is not empty: add the separator
    • add the config title

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

18/09 2015

v1.0.2

1.0.2.0 https://github.com/aurmil/slim2-skeleton

A Slim Framework v2 application skeleton

  Sources   Download

MIT

The Requires

 

slim microframework slimphp

18/09 2015

v1.0.1

1.0.1.0 https://github.com/aurmil/slim2-skeleton

A Slim Framework v2 application skeleton

  Sources   Download

MIT

The Requires

 

slim microframework slimphp