2017 © Pedro Peláez
 

library slimapp

Common classes to help with creating an application using the Slim micro framework and Twig template engine.

image

wikimedia/slimapp

Common classes to help with creating an application using the Slim micro framework and Twig template engine.

  • Sunday, March 11, 2018
  • by wikimedia
  • Repository
  • 16 Watchers
  • 3 Stars
  • 1,752 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 2 % Grown

The README.md

Wikimedia SlimApp

Common classes to help with creating an application using the Slim micro framework and Twig template engine., (*1)

System Requirements

  • PHP >= 7.2.0

Configuration

The library follows the Twelve-Factor App configuration principle of configuration via environment variables., (*2)

The following variables can be optionally provided:, (*3)

  • LOG_CHANNEL = Logger name (default: app)
  • LOG_LEVEL = PSR-3 logging level (default: notice)
  • LOG_FILE = fopen()-compatible filename or stream URI (default: php://stderr)
  • CACHE_DIR = Directory to cache twig templates (default: data/cache)
  • SMTP_HOST = SMTP mail server (default: localhost)
  • TEMPLATE_DIR = Twig template directory (default: data/templates)
  • I18N_DIR = i18n data file directory (default: data/i18n)
  • DEFAULT_LANG = Default i18n lanaguage (default: en)

Apache

SetEnv LOG_LEVEL debug
SetEnv CACHE_DIR /var/cache/twig
SetEnv DEFAULT_LANG es

.env file

For environments where container based configuration isn't possible or desired, a .env file can be placed in the root of the project. This file will be parsed using PHP's parse_ini_file() function and the resulting settings will be injected into the application environment., (*4)

LOG_LEVEL=debug
CACHE_DIR=/var/cache/twig
DEFAULT_LANG=es

Working on the code

Code review process is done through Gerrit. To start hacking on the application refer to the Gerrit Tutorial., (*5)

Key Features

Dao

Base Class for data access objects, (*6)

This class contains common methods for performing SQL operations and handling nested transactions., (*7)

Controller

Page Controller, (*8)

This class contains common methods for setting default data, getting flash messages and handling undefined methods., (*9)

Form

Class for collecting and validating users' data, (*10)

This class contains common methods for getting users' data, validating it and getting error messages in case of invalid data., (*11)

Authors

  • Bryan Davis, Wikimedia Foundation
  • Niharika Kohli, Wikimedia Foundation

Based on code developed for the Wikimania Scholarships application and the Wikimedia Grants Review application., (*12)

License

GNU GPL 3.0+, (*13)

The Versions