2017 © Pedro Peláez
 

library slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

image

slim/slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  • Wednesday, July 18, 2018
  • by akrabat
  • Repository
  • 592 Watchers
  • 9094 Stars
  • 6,392,104 Installations
  • PHP
  • 1022 Dependents
  • 18 Suggesters
  • 1791 Forks
  • 62 Open issues
  • 52 Versions
  • 8 % Grown

The README.md

Slim Framework

Build Status Coverage Status Total Downloads License, (*1)

Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs., (*2)

Installation

It's recommended that you use Composer to install Slim., (*3)

$ composer require slim/slim

This will install Slim and all required dependencies. Slim requires PHP 7.4 or newer., (*4)

Choose a PSR-7 Implementation & ServerRequest Creator

Before you can get up and running with Slim you will need to choose a PSR-7 implementation that best fits your application. A few notable ones: - Slim-Psr7 - This is the Slim Framework PSR-7 implementation - httpsoft/http-message & httpsoft/http-server-request - This is the fastest, strictest and most lightweight implementation available - Nyholm/psr7 & Nyholm/psr7-server - Performance is almost the same as the HttpSoft implementation - Guzzle/psr7 - This is the implementation used by the Guzzle Client, featuring extra functionality for stream and file handling - laminas-diactoros - This is the Laminas (Zend) PSR-7 implementation, (*5)

Slim-Http Decorators

Slim-Http is a set of decorators for any PSR-7 implementation that we recommend is used with Slim Framework. To install the Slim-Http library simply run the following command:, (*6)

composer require slim/http

The ServerRequest and Response object decorators are automatically detected and applied by the internal factories. If you have installed Slim-Http and wish to turn off automatic object decoration then you can use the following statements:, (*7)

<?php

use Slim\Factory\AppFactory;
use Slim\Factory\ServerRequestCreatorFactory;

AppFactory::setSlimHttpDecoratorsAutomaticDetection(false);
ServerRequestCreatorFactory::setSlimHttpDecoratorsAutomaticDetection(false);

$app = AppFactory::create();

// ...

Hello World using AppFactory with PSR-7 auto-detection

In order for auto-detection to work and enable you to use AppFactory::create() and App::run() without having to manually create a ServerRequest you need to install one of the following implementations: - Slim-Psr7 - Install using composer require slim/psr7 - httpsoft/http-message & httpsoft/http-server-request - Install using: composer require httpsoft/http-message httpsoft/http-server-request - Nyholm/psr7 & Nyholm/psr7-server - Install using composer require nyholm/psr7 nyholm/psr7-server - Guzzle/psr7 - Install using composer require guzzlehttp/psr7 - laminas-diactoros - Install using composer require laminas/laminas-diactoros, (*8)

Then create file public/index.php., (*9)

<?php
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\Factory\AppFactory;

require __DIR__ . '/../vendor/autoload.php';

// Instantiate App
$app = AppFactory::create();

// Add error middleware
$app->addErrorMiddleware(true, true, true);

// Add routes
$app->get('/', function (Request $request, Response $response) {
    $response->getBody()->write('<a href="/hello/world">Try /hello/world</a>');
    return $response;
});

$app->get('/hello/{name}', function (Request $request, Response $response, $args) {
    $name = $args['name'];
    $response->getBody()->write("Hello, $name");
    return $response;
});

$app->run();

You may quickly test this using the built-in PHP server:, (*10)

$ php -S localhost:8000 -t public

Going to http://localhost:8000/hello/world will now display "Hello, world"., (*11)

For more information on how to configure your web server, see the Documentation., (*12)

Tests

To execute the test suite, you'll need to install all development dependencies., (*13)

$ git clone https://github.com/slimphp/Slim
$ composer install
$ composer test

Contributing

Please see CONTRIBUTING for details., (*14)

Learn More

Learn more at these links:, (*15)

Security

If you discover security related issues, please email security@slimframework.com instead of using the issue tracker., (*16)

For enterprise

Available as part of the Tidelift Subscription., (*17)

The maintainers of Slim and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more., (*18)

Contributors

Code Contributors

This project exists thanks to all the people who contribute. Contribute. , (*19)

Financial Contributors

Become a financial contributor and help us sustain our community. Contribute, (*20)

Individuals

, (*21)

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. Contribute, (*22)

, (*23)

License

The Slim Framework is licensed under the MIT license. See License File for more information., (*24)

The Versions

18/07 2018

4.x-dev

4.9999999.9999999.9999999-dev https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

15/07 2018

3.x-dev

3.9999999.9999999.9999999-dev https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

19/04 2018

3.10.0

3.10.0.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

26/11 2017

3.9.2

3.9.2.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

26/11 2017

3.9.1

3.9.1.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

04/11 2017

3.9.0

3.9.0.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

19/03 2017

3.8.1

3.8.1.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

18/03 2017

3.8.0

3.8.0.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

07/01 2017

2.x-dev

2.9999999.9999999.9999999-dev http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

07/01 2017

2.6.3

2.6.3.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

20/12 2016

3.7.0

3.7.0.0 https://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

20/11 2016

3.6.0

3.6.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

26/07 2016

3.5.0

3.5.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

25/05 2016

3.4.2

3.4.2.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

16/05 2016

3.4.1

3.4.1.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

09/05 2016

3.4.0

3.4.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

10/03 2016

3.3.0

3.3.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

05/03 2016

3.2.2

3.2.2.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

29/02 2016

3.2.1

3.2.1.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

25/02 2016

3.2.0

3.2.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

08/01 2016

3.1.0

3.1.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

07/12 2015

3.0.0

3.0.0.0 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

29/11 2015

3.0.0-RC3

3.0.0.0-RC3 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

09/11 2015

3.0.0-RC2

3.0.0.0-RC2 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

07/09 2015

3.0.0-RC1

3.0.0.0-RC1 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

10/08 2015

3.0.0-beta2

3.0.0.0-beta2 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

02/07 2015

3.0-beta1

3.0.0.0-beta1 http://slimframework.com

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs

  Sources   Download

MIT

The Requires

 

The Development Requires

api micro framework router

08/03 2015

2.6.2

2.6.2.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

02/03 2015

2.6.1

2.6.1.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

02/03 2015

2.6.0

2.6.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

09/12 2014

2.5.0

2.5.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

05/04 2014

2.4.3

2.4.3.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

16/02 2014

2.4.2

2.4.2.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

16/02 2014

2.4.1

2.4.1.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

29/11 2013

2.4.0

2.4.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

31/10 2013

2.3.5

2.3.5.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

26/10 2013

2.3.4

2.3.4.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

12/10 2013

2.3.3

2.3.3.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

29/09 2013

2.3.2

2.3.2.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

20/07 2013

2.3.1

2.3.1.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

14/07 2013

2.3.0

2.3.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mcrypt *

 

rest microframework router

13/12 2012

2.2.0

2.2.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

12/09 2012

2.1.0

2.1.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

09/09 2012

2.0.0

2.0.0.0 http://github.com/codeguy/Slim

Slim Framework, a PHP micro framework

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

rest microframework router

29/08 2012

1.6.7

1.6.7.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

rest microframework router

26/08 2012

1.6.6

1.6.6.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

rest microframework router

31/07 2012

1.6.5

1.6.5.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

rest microframework router

24/06 2012

1.6.4

1.6.4.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

rest microframework router

17/06 2012

1.6.3

1.6.3.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

rest microframework router

22/04 2012

1.6.2

1.6.2.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

templating extensions

21/04 2012

1.6.1

1.6.1.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

templating extensions

14/04 2012

1.6.0

1.6.0.0 http://github.com/codeguy/Slim

Slim Framework, a micro framework for PHP 5

  Sources   Download

MIT

The Requires

  • php >=5.2.0

 

templating extensions