slim/extras
Composer 安装命令:
composer require slim/extras
包简介
Extras package for the Slim Framework
README 文档
README
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.
slim/extras 适用场景与选型建议
slim/extras 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 513.88k 次下载、GitHub Stars 达 482, 最近一次更新时间为 2012 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「templating」 「extensions」 「middleware」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 slim/extras 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slim/extras 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 slim/extras 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
A collection of helpers for PHPUnit to ease testing Tarantool libraries.
Register more Twig filters for your OctoberCMS templates
A Processor for Markup written in PHP. Allows extraction of Markup into a data structure, orchestrated nested manipulation of said structure, and output as (optimized) Markup.
Bundle for Doctrine enumerations extension for Postgres
Doctrine extension to manage enumerations in PostgreSQL
统计信息
- 总下载量: 513.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 491
- 点击次数: 24
- 依赖项目数: 13
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-03-28