From 98a3a486ddd6c9de0ad62ec1f1af8d69429f415d Mon Sep 17 00:00:00 2001 From: l0gicgate Date: Tue, 30 Jul 2019 11:52:48 -0600 Subject: [PATCH] add OpenCollective information and fix examples --- README.md | 65 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index e78942387..ef14ebc16 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Slim is a PHP micro-framework that helps you quickly write simple yet powerful w It's recommended that you use [Composer](https://getcomposer.org/) to install Slim. ```bash -$ composer require slim/slim:4.0.0-beta +$ composer require slim/slim:4.0.0 ``` This will install Slim and all required dependencies. Slim requires PHP 7.1 or newer. @@ -20,10 +20,10 @@ This will install Slim and all required dependencies. Slim requires PHP 7.1 or n ## 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](https://github.com/slimphp/Slim-Psr7) - This is the Slim Framework projects PSR-7 implementation. -- [Nyholm/psr7](https://github.com/Nyholm/psr7) & [Nyholm/psr7-server](https://github.com/Nyholm/psr7-server) - This is the fastest, strictest and most lightweight implementation at the moment. -- [Guzzle/psr7](https://github.com/guzzle/psr7) & [http-interop/http-factory-guzzle](https://github.com/http-interop/http-factory-guzzle) - This is the implementation used by the Guzzle Client. It is not as strict but adds some nice functionality for Streams and file handling. It is the second fastest implementation but is a bit bulkier. -- [zend-diactoros](https://github.com/zendframework/zend-diactoros) - This is the Zend implementation. It is the slowest implementation of the four. +- [Slim-Psr7](https://github.com/slimphp/Slim-Psr7) - This is the Slim Framework PSR-7 implementation +- [Nyholm/psr7](https://github.com/Nyholm/psr7) & [Nyholm/psr7-server](https://github.com/Nyholm/psr7-server) - This is the fastest, strictest and most lightweight implementation available +- [Guzzle/psr7](https://github.com/guzzle/psr7) & [http-interop/http-factory-guzzle](https://github.com/http-interop/http-factory-guzzle) - This is the implementation used by the Guzzle Client, featuring extra functionality for stream and file handling +- [zend-diactoros](https://github.com/zendframework/zend-diactoros) - This is the Zend PSR-7 implementation ## Slim-Http Decorators @@ -47,7 +47,7 @@ ServerRequestCreatorFactory::setSlimHttpDecoratorsAutomaticDetection(false); $app = AppFactory::create(); -... +// ... ``` ## Hello World using AppFactory with PSR-7 auto-detection @@ -62,7 +62,6 @@ In order for auto-detection to work and enable you to use `AppFactory::create()` use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; -use Slim\Middleware\ErrorMiddleware; require __DIR__ . '/../vendor/autoload.php'; @@ -70,9 +69,7 @@ require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); // Add error middleware -$responseFactory = $app->getResponseFactory(); -$errorMiddleware = new ErrorMiddleware($app->getCallableResolver(), $responseFactory, true, true, true); -$app->add($errorMiddleware); +$app->addErrorMiddleware(true, true, true); // Add route $app->get('/hello/{name}', function (Request $request, Response $response, $args) { @@ -91,7 +88,7 @@ $ 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](https://www.slimframework.com/docs/start/web-servers.html). +For more information on how to configure your web server, see the [Documentation](https://www.slimframework.com/docs/v4/start/web-servers.html). ## Tests To execute the test suite, you'll need to install all development dependencies. @@ -111,8 +108,9 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details. Learn more at these links: - [Website](https://www.slimframework.com) -- [Documentation](https://www.slimframework.com/docs/start/installation.html) -- [Support Forum](http://discourse.slimframework.com) +- [Documentation](https://www.slimframework.com/docs/v4/start/installation.html) +- [Slack](https://slimphp.slack.com) +- [Support Forum](https://discourse.slimframework.com) - [Twitter](https://twitter.com/slimphp) - [Resources](https://github.com/xssc/awesome-slim) @@ -120,14 +118,41 @@ Learn more at these links: If you discover security related issues, please email security@slimframework.com instead of using the issue tracker. -## Credits +## Professional support -- [Josh Lockhart](https://github.com/codeguy) -- [Andrew Smith](https://github.com/silentworks) -- [Rob Allen](https://github.com/akrabat) -- [Pierre Bérubé](https://github.com/l0gicgate) -- [Gabriel Manricks](https://github.com/gmanricks) -- [All Contributors](../../contributors) +Slim is part of [Tidelift](https://tidelift.com/subscription/pkg/packagist-slim-slim?utm_source=packagist-slim-slim&utm_medium=referral&utm_campaign=readme) which gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools. + +## Contributors + +### Code Contributors + +This project exists thanks to all the people who contribute. [Contribute](CONTRIBUTING.md). + + + + +### Financial Contributors + +Become a financial contributor and help us sustain our community. [Contribute](https://opencollective.com/slimphp/contribute) + +#### Individuals + + + +#### Organizations + +Support this project with your organization. Your logo will show up here with a link to your website. [Contribute](https://opencollective.com/slimphp/contribute) + + + + + + + + + + + ## License