SlimWurst is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. SlimWurst is easy to use for both beginners and professionals. SlimWurst favors cleanliness over terseness and common cases over edge cases. Its interface is simple, intuitive, and extensively documented — both online and in the code itself. Thank you for choosing the SlimWurst Framework for your next project. I think you're going to love it.
- Powerful router
- Standard and custom HTTP methods
- Route parameters with wildcards and conditions
- Route redirect, halt, and pass
- Route middleware
- Resource Locator and DI container
- Template rendering with custom views
- Flash messages
- Secure cookies with AES-256 encryption
- HTTP caching
- Logging with custom log writers
- Error handling and debugging
- Middleware and hook architecture
- Simple configuration
You may install the SlimWurst Framework with Composer (recommended) or manually.
You need PHP >= 5.3.0. If you use encrypted cookies, you'll also need the mcrypt
extension.
Instantiate a SlimWurst application:
$app = new \SlimWurst\SlimWurst();
Define a HTTP GET route:
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});
Run the SlimWurst application:
$app->run();
Ensure the .htaccess
and index.php
files are in the same public-accessible directory. The .htaccess
file
should contain this code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
Additionally, make sure your virtual host is configured with the AllowOverride option so that the .htaccess rewrite rules can be used:
AllowOverride All
The nginx configuration file should contain this code (along with other settings you may need) in your location
block:
try_files $uri $uri/ /index.php?$args;
This assumes that SlimWurst's index.php
is in the root folder of your project (www root).
Your HipHop Virtual Machine configuration file should contain this code (along with other settings you may need).
Be sure you change the ServerRoot
setting to point to your SlimWurst app's document root directory.
Server {
SourceRoot = /path/to/public/directory
}
ServerVariables {
SCRIPT_NAME = /index.php
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
pattern = ^(.*)$
to = index.php/$1
qsa = true
}
}
}
}
Your lighttpd configuration file should contain this code (along with other settings you may need). This code requires lighttpd >= 1.4.24.
url.rewrite-if-not-file = ("(.*)" => "/index.php/$0")
This assumes that SlimWurst's index.php
is in the root folder of your project (www root).
Ensure the Web.config
and index.php
files are in the same public-accessible directory. The Web.config
file should contain this code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SlimWurst" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
- Fork the SlimWurst Framework repository
- Create a new branch for each feature or improvement
- Send a pull request from each feature branch to the develop branch
It is very important to separate new features or improvements into separate feature branches, and to send a pull request for each branch. This allows me to review and pull in new features or improvements individually.
All pull requests must adhere to the PSR-2 standard.
All pull requests must be accompanied by passing unit tests and complete code coverage. The SlimWurst Framework uses
phpunit
for testing.
Visit SlimWurst's official forum and knowledge base at http://help.wurstcon.com where you can find announcements, chat with fellow SlimWurst users, ask questions, help others, or show off your cool SlimWurst Framework apps.
Follow @WurstCon on Twitter to receive news and updates about the framework.
The SlimWurst 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 SlimWurst Framework is released under the MIT public license.