This repository contains extra resources that complement the Slim Framework, a PHP micro framework that helps you quickly write simple yet powerful web applications.
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.
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.
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.
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.
The Slim Framework is released under the MIT public license.
slim-extras's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.