afief / slim
This is a form repo of slim framework from slim/slim with some update like middleware arguments, return object response into a json string, etc. Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs
Requires
- php: >=5.5.0
- container-interop/container-interop: ^1.1
- nikic/fast-route: ^1.0
- pimple/pimple: ^3.0
- psr/http-message: ^1.0
Requires (Dev)
- phpunit/phpunit: ^4.0
- squizlabs/php_codesniffer: ^2.5
Provides
- 3.x-dev
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.0
- 3.0.0-RC3
- 3.0.0-RC2
- 3.0.0-RC1
- 3.0.0-beta2
- 3.0.0-beta1
- 2.x-dev
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.0
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- dev-improvement/route
This package is not auto-updated.
Last update: 2024-10-24 18:37:07 UTC
README
Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs.
Installation
It's recommended that you use Composer to install Slim.
$ composer require slim/slim "^3.0"
This will install Slim and all required dependencies. Slim requires PHP 5.5.0 or newer.
Usage
Create an index.php file with the following contents:
<?php require 'vendor/autoload.php'; $app = new Slim\App(); $app->get('/hello/{name}', function ($request, $response, $args) { $response->write("Hello, " . $args['name']); return $response; }); $app->run();
You may quickly test this using the built-in PHP server:
$ php -S localhost:8000
Going to http://localhost:8000/hello/world will now display "Hello, world".
For more information on how to configure your web server, see the Documentation.
Additional Features
- Return an object from controller into json string
- Additional arguments for middleware
$mw = function ($request, $response, $next, $arg1, $arg2) { $response->getBody()->write($arg1); $response = $next($request, $response); $response->getBody()->write($arg2); return $response; }; $app->get('/hello/{name}', function ($request, $response, $args) { $response->write("Hello, " . $args['name']); return $response; })->add($mw, ['first_argument', 'second_argument']);
Tests
To execute the test suite, you'll need phpunit.
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Learn More
Learn more at these links:
Security
If you discover security related issues, please email security@slimframework.com instead of using the issue tracker.
Credits
License
The Slim Framework is licensed under the MIT license. See License File for more information.