Giter Site home page Giter Site logo

slim-extras's Introduction

Slim Framework Extras

This repository contains extra resources that complement the Slim Framework, a PHP micro framework that helps you quickly write simple yet powerful web applications.


For custom views we are now recommending using the Slim Views repo instead. We are simplifying the amount of views we officially support and will be splitting up the Slim Extras repo into smaller chunks.

For custom loggers we are now recommending using the Slim Logger repo instead.


Custom Views

This repository contains custom views for your Slim Framework applications. Custom views let you easily use popular third-party templating frameworks, like Twig or Smarty, with your Slim Framework application.

  • Smarty
  • Twig
  • Mustache
  • Haml
  • Haanga
  • Blitz
  • Dwoo
  • Sugar
  • Savant
  • Rain
  • H2o

This example demonstrates how to use the custom Twig view in your Slim Framework application:

<?php
// Setup custom Twig view
$twigView = new \Slim\Extras\Views\Twig();

// Instantiate application
$app = new \Slim\Slim(array(
    'view' => $twigView
));

This example assumes you are autoloading dependencies using Composer. If you are not using Composer, you must manually require the custom view class before instantiating it.

Read the Slim Framework documentation to learn how to write your own custom view.

Middleware

This repository also contains middleware for your Slim Framework application. This example demonstrates how to apply HTTP basic authentication to a Slim Framework application:

<?php
$app = new \Slim\Slim();
$app->add(new \Slim\Extras\Middleware\HttpBasicAuth('username', 'password'));

This example assumes you are autoloading dependencies using Composer. If you are not using Composer, you must manually require the custom middleware class before instantiating it.

Log Writers

This repository also contains custom log writers for your Slim Framwork application. This example demonstrates how to use the custom DateTimeLogWriter to write rolling log files from your Slim Framework application:

<?php
$app = new \Slim\Slim(array(
    'log.writer' => new \Slim\Extras\Log\DateTimeFileWriter(array(
        'path' => './logs',
        'name_format' => 'Y-m-d',
        'message_format' => '%label% - %date% - %message%'
    ))
));

This example assumes you are autoloading dependencies using Composer. If you are not using Composer, you must manually require the log writer class before instantiating it.

Author

The Slim Framework is created and maintained by Josh Lockhart. Josh is a senior web developer at New Media Campaigns. Josh also created and maintains PHP: The Right Way, a popular movement in the PHP community to introduce new PHP programmers to best practices and good information.

The Slim Framework Extras repository is maintained by Andrew Smith.

License

The Slim Framework is released under the MIT public license.

http://www.slimframework.com/license

slim-extras's People

Contributors

silentworks avatar ziadoz avatar tomvo avatar mateusza avatar cenan avatar richleland avatar robot-c0der avatar briannesbitt avatar davidepastore avatar ianvanness avatar m92o avatar techdubb avatar boypt avatar avilaj avatar chenly avatar hanseartic avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.