Skip to content
项目

关于

(已弃用)Slim Framework 资源

开发工具

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
正在收集历史
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

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

探索相关项目

加载中…