rpicms

A CMS for the Raspberry Pi
git clone git://archive.git.mtrnord.blog/RpicmsTeam/rpicms.git
Log | Files | Refs | README | LICENSE

README.markdown (6484B)


      1 # Slim Framework
      2 
      3 [![Build Status](https://secure.travis-ci.org/codeguy/Slim.png?branch=master)](http://travis-ci.org/codeguy/Slim)
      4 
      5 Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
      6 Slim is easy to use for both beginners and professionals. Slim favors cleanliness over terseness and common cases
      7 over edge cases. Its interface is simple, intuitive, and extensively documented — both online and in the code itself.
      8 Thank you for choosing the Slim Framework for your next project. I think you're going to love it.
      9 
     10 ## Features
     11 
     12 * Powerful router
     13     * Standard and custom HTTP methods
     14     * Route parameters with wildcards and conditions
     15     * Route redirect, halt, and pass
     16     * Route middleware
     17 * Resource Locator and DI container
     18 * Template rendering with custom views
     19 * Flash messages
     20 * Secure cookies with AES-256 encryption
     21 * HTTP caching
     22 * Logging with custom log writers
     23 * Error handling and debugging
     24 * Middleware and hook architecture
     25 * Simple configuration
     26 
     27 ## Getting Started
     28 
     29 ### Install
     30 
     31 You may install the Slim Framework with Composer (recommended) or manually.
     32 
     33 [Read how to install Slim](http://docs.slimframework.com/#Installation)
     34 
     35 ### System Requirements
     36 
     37 You need **PHP >= 5.3.0**. If you use encrypted cookies, you'll also need the `mcrypt` extension.
     38 
     39 ### Hello World Tutorial
     40 
     41 Instantiate a Slim application:
     42 
     43     $app = new \Slim\Slim();
     44 
     45 Define a HTTP GET route:
     46 
     47     $app->get('/hello/:name', function ($name) {
     48         echo "Hello, $name";
     49     });
     50 
     51 Run the Slim application:
     52 
     53     $app->run();
     54 
     55 ### Setup your web server
     56 
     57 #### Apache
     58 
     59 Ensure the `.htaccess` and `index.php` files are in the same public-accessible directory. The `.htaccess` file
     60 should contain this code:
     61 
     62     RewriteEngine On
     63     RewriteCond %{REQUEST_FILENAME} !-f
     64     RewriteRule ^ index.php [QSA,L]
     65 
     66 Additionally, make sure your virtual host is configured with the AllowOverride option so that the .htaccess rewrite rules can be used:
     67 
     68    AllowOverride All
     69 
     70 #### Nginx
     71 
     72 The nginx configuration file should contain this code (along with other settings you may need) in your `location` block:
     73 
     74     try_files $uri $uri/ /index.php?$args;
     75 
     76 This assumes that Slim's `index.php` is in the root folder of your project (www root).
     77 
     78 #### HipHop Virtual Machine for PHP
     79 
     80 Your HipHop Virtual Machine configuration file should contain this code (along with other settings you may need).
     81 Be sure you change the `ServerRoot` setting to point to your Slim app's document root directory.
     82 
     83     Server {
     84         SourceRoot = /path/to/public/directory
     85     }
     86 
     87     ServerVariables {
     88         SCRIPT_NAME = /index.php
     89     }
     90 
     91     VirtualHost {
     92         * {
     93             Pattern = .*
     94             RewriteRules {
     95                     * {
     96                             pattern = ^(.*)$
     97                             to = index.php/$1
     98                             qsa = true
     99                     }
    100             }
    101         }
    102     }
    103 
    104 #### lighttpd ####
    105 
    106 Your lighttpd configuration file should contain this code (along with other settings you may need). This code requires
    107 lighttpd >= 1.4.24.
    108 
    109     url.rewrite-if-not-file = ("(.*)" => "/index.php/$0")
    110 
    111 This assumes that Slim's `index.php` is in the root folder of your project (www root).
    112 
    113 #### IIS
    114 
    115 Ensure the `Web.config` and `index.php` files are in the same public-accessible directory. The `Web.config` file should contain this code:
    116 
    117     <?xml version="1.0" encoding="UTF-8"?>
    118     <configuration>
    119         <system.webServer>
    120             <rewrite>
    121                 <rules>
    122                     <rule name="slim" patternSyntax="Wildcard">
    123                         <match url="*" />
    124                         <conditions>
    125                             <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    126                             <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    127                         </conditions>
    128                         <action type="Rewrite" url="index.php" />
    129                     </rule>
    130                 </rules>
    131             </rewrite>
    132         </system.webServer>
    133     </configuration>
    134 
    135 #### Google App Engine
    136 
    137 Two steps are required to successfully run your Slim application on Google App Engine. First, ensure the `app.yaml` file includes a default handler to `index.php`:
    138 
    139     application: your-app-name
    140     version: 1
    141     runtime: php
    142     api_version: 1
    143     
    144     handlers:
    145     # ...
    146     - url: /.*
    147       script: public_html/index.php
    148 
    149 Next, edit your `index.php` file so Slim knows about the incoming URI:
    150 
    151     $app = new Slim();
    152     
    153     // Google App Engine doesn't set $_SERVER['PATH_INFO']
    154     $app->environment['PATH_INFO'] = $_SERVER['REQUEST_URI'];
    155     
    156     // ...
    157     $app->run();
    158 
    159    
    160 ## Documentation
    161 
    162 <http://docs.slimframework.com/>
    163 
    164 ## How to Contribute
    165 
    166 ### Pull Requests
    167 
    168 1. Fork the Slim Framework repository
    169 2. Create a new branch for each feature or improvement
    170 3. Send a pull request from each feature branch to the **develop** branch
    171 
    172 It is very important to separate new features or improvements into separate feature branches, and to send a pull
    173 request for each branch. This allows me to review and pull in new features or improvements individually.
    174 
    175 ### Style Guide
    176 
    177 All pull requests must adhere to the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) standard.
    178 
    179 ### Unit Testing
    180 
    181 All pull requests must be accompanied by passing unit tests and complete code coverage. The Slim Framework uses
    182 `phpunit` for testing.
    183 
    184 [Learn about PHPUnit](https://github.com/sebastianbergmann/phpunit/)
    185 
    186 ## Community
    187 
    188 ### Forum and Knowledgebase
    189 
    190 Visit Slim's official forum and knowledge base at <http://help.slimframework.com> where you can find announcements,
    191 chat with fellow Slim users, ask questions, help others, or show off your cool Slim Framework apps.
    192 
    193 ### Twitter
    194 
    195 Follow [@slimphp](http://www.twitter.com/slimphp) on Twitter to receive news and updates about the framework.
    196 
    197 ## Author
    198 
    199 The Slim Framework is created and maintained by [Josh Lockhart](http://www.joshlockhart.com). Josh is a senior
    200 web developer at [New Media Campaigns](http://www.newmediacampaigns.com/). Josh also created and maintains
    201 [PHP: The Right Way](http://www.phptherightway.com/), a popular movement in the PHP community to introduce new
    202 PHP programmers to best practices and good information.
    203 
    204 ## License
    205 
    206 The Slim Framework is released under the MIT public license.
    207 
    208 <http://www.slimframework.com/license>