ice framework!
Ice - simple, fast and open-source PHP framework frozen in C-extension. Ice is loosely coupled, allowing developers to use only the components that they need.
Simple and Extremely Fast.
One major drawback for PHP is that on every request, all files are read from the hard drive, translated into bytecode, and then executed.
With Ice the whole framework already is in RAM, so the whole set of framework files don't need to process. That means that when scaling, you need few times fewer servers to support the same traffic. Check the PHP framework benchmark.
Delivered as C-extension.
About 90% of an iceberg is below the surface of the water... The fact that you do not see code does not mean that it is not powerful!
You don't need learn or use the C language, since the functionality is exposed as PHP classes ready for you to use. Ice is written in Zephir, so you can easily check the logic in API and make some changes.
Sleet template engine.
Sleet is lightweight and fast compiling PHP template engine written in C. Sleet syntax highlight is available in the Atom editor.
Download package: language-sleet
Working with models.
A powerful Model is provided by Ice allowing you to manipulate database records / documents as classes and objects. Object Relational Mapping for PDO and Object Document Mapping for MongoDB at once!
// Find the user
$user = Users::findOne([
'username' => 'ice'
]);
// Get user's posts
$posts = $user->getPosts([
'status' => Posts::ACTIVE
]);
foreach ($posts as $post) {
// Display a title of the post
echo $post->title;
}
Built-in authentication.
User authentication and authorization is provided by the auth module. The auth module provides the Model driver for you. There is also a File auth driver.
{# Check whether an user is logged in #}
{% if this.auth.loggedIn() %}
{# Get logged in user's data #}
{{ this.auth.getUser().username }}
{% endif %}
{# Check whether an user is the admin #}
{% if this.auth.loggedIn('admin') %}
{# Admin privileges #}
{% else %}
{# No access #}
{% endif %}
Example of validation.
Validation can be performed on any array using our clever class. Labels and rules can be attached to a Validation object by the array key, called a field name.
You can easily perform validation on the HTTP POST data of the current request that contains user contact form, see more Validation examples.
$validation = new Ice\Validation();
$validation->rules([
'fullName' => 'required',
'email' => 'required|email',
'repeatEmail' => 'same:email',
'content' => 'required|length:10,5000',
]);
$validation->setFilters([
'fullName' => 'string'
'email' => 'email'
'content' => 'repeats|escape'
]);
$data = $this->request->getPost()->getData();
$validation->validate($data);
if (!$validation->valid()) {
$messages = $validation->getMessages();
}