Jolt
Jolt is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs., (*1)
Jolt takes some inspiration from ExpressJS., (*2)
Jolt is not a full featured MVC framework, it is built to be a micro framework that handles routing and carries some basic template rendering. Feel free to use your own template engine such as Twig instead., (*3)
You can see more info at the Jolt wiki:, (*4)
For database, I recommend Idiorm and Paris, (*5)
If you don't want to use Composer, then you can use the autoloader., (*6)
If you're looking for the older version of Jolt, you can find it here in the legacy branch of the repo., (*7)
Requirements
Getting Started
Install
You may install the Jolt Framework with Composer (recommended) or manually., (*8)
Read how to install Jolt., (*9)
Hello World Tutorial
A typical PHP app using Jolt will look like this., (*10)
If you didn't install Jolt via Composer, then use the following to load Jolt:, (*11)
```php
get('/hello/:name', function ($name) use ($app){
echo "Hello, $name";
});
```
Run the Jolt application:
```php
$app->listen();
```
### Setup your web server
#### Apache
Ensure the `.htaccess` and `index.php` files are in the same public-accessible directory. The `.htaccess` file
should contain this code:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
#### Nginx
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 Jolt's `index.php` is in the root folder of your project (www root).
#### HipHop Virtual Machine for PHP
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 Jolt 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
}
}
}
}
#### lighttpd ####
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 Jolt's `index.php` is in the root folder of your project (www root).
#### IIS
Ensure the `Web.config` and `index.php` files are in the same public-accessible directory. The `Web.config` file should contain this code:
system.webServer
/system.webServer
, (*12)
Documentation
https://github.com/freekrai/jolt/wiki/usage, (*13)
How to Contribute
Pull Requests
- Fork the Jolt 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., (*14)