diff --git a/README.md b/README.md index 34a6a2b..928a49b 100644 --- a/README.md +++ b/README.md @@ -123,5 +123,5 @@ The runs a site you can access at [http://localhost:8080](http://localhost:8080) Copyright and License --------------------- -Copyright © 202 by PJ Dietz +Copyright © 2020 by PJ Dietz Licensed under the [MIT license](http://opensource.org/licenses/MIT) diff --git a/docs/source/changes-from-version-3.rst b/docs/source/changes-from-version-3.rst deleted file mode 100644 index 4ff8bc7..0000000 --- a/docs/source/changes-from-version-3.rst +++ /dev/null @@ -1,16 +0,0 @@ -Changes from Version 3 -====================== - -If your project uses WellRESTed version 3, you can most likely upgrade to to version 4 without making any changes to your code. However, there are a few changes that may affect some users, particularly users who have subclassed ``WellRESTed\Server`` or used custom implementations of other ``WellRESTed`` classes. - -Server Configuration -^^^^^^^^^^^^^^^^^^^^ - -Version 4 allows for easier customization of the server than version 3. Previously, to customize the Server, you would need to subclass Server and override protected methods that provided a default request, response, transmitter, etc. The Server in version 4 now provides the following setters for providing custom behavior: - -- ``setAttributes(array $attributes)`` -- ``setDispatcher(DispatcherInterface $dispatcher)`` -- ``setPathVariablesAttributeName(string $name)`` -- ``setRequest(ServerRequestInterface $request)`` -- ``setResponse(ResponseInterface $response)`` -- ``setTransmitter(TransmitterInterface $transmitter)`` diff --git a/docs/source/conf.py b/docs/source/conf.py index fe831cb..2c1ed94 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -25,9 +25,9 @@ master_doc = 'index' # General information about the project. project = u'WellRESTed' -copyright = u'2018, PJ Dietz' -version = '4.0.0' -release = '4.0.0' +copyright = u'202, PJ Dietz' +version = '5.0.0' +release = '5.0.0' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/docs/source/extending.rst b/docs/source/extending.rst index 8f3f180..7cc1d28 100644 --- a/docs/source/extending.rst +++ b/docs/source/extending.rst @@ -73,7 +73,7 @@ If you need the ability to dispatch other types of middleware, you can create yo $response = parent::dispatch($dispatchable, $request, $response, $next); } catch (\WellRESTed\Dispatching\DispatchException $e) { // If there's a problem, check if the handler or middleware - // (the "dispatchable") implements OtherHandlerInterface. + // (the "dispatchable") implements OtherHandlerInterface. // Dispatch it if it does. if ($dispatchable instanceof OtherHandlerInterface) { $response = $dispatchable->run($request); @@ -93,18 +93,9 @@ To use this dispatcher, create an instance implementing ``WellRESTed\Dispatching $server = new WellRESTed\Server(); $server->setDispatcher(new MyApi\CustomDispatcher()); -Message Customization ---------------------- +.. warning:: -In the example above, we passed a custom dispatcher to the server. You can also customize your server in other ways. For example, when the server reaches these end of its stack of middleware and has not had the response handled, it returns a blank 404 error response. You can customize this by passing a response to the server's ``setUnhandledResponse`` method. - -.. code-block:: php - - $unhandled = (new Response(404)) - ->withHeader('text/html') - ->withBody($fancy404message); - - $server->setUnhandledResponse($unhandled); + When you supply a custom Dispatcher, be sure to call ``Server::setDispatcher`` before you create any routers with ``Server::createRouter`` to allow the ``Server`` to pass you customer ``Dispatcher`` on to the newly created ``Router``. .. _PSR-7: https://www.php-fig.org/psr/psr-7/ .. _Handlers and Middleware: handlers-and-middleware.html diff --git a/docs/source/index.rst b/docs/source/index.rst index 6491e5d..81a84ac 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -138,7 +138,6 @@ Contents dependency-injection additional web-server-configuration - changes-from-version-3 .. _PSR-7: https://www.php-fig.org/psr/psr-7/ .. _PSR-15: https://www.php-fig.org/psr/psr-15/ diff --git a/docs/source/overview.rst b/docs/source/overview.rst index 7a570a1..6714ab4 100644 --- a/docs/source/overview.rst +++ b/docs/source/overview.rst @@ -10,14 +10,14 @@ The recommended method for installing WellRESTed is to use Composer_. Add an ent { "require": { - "wellrested/wellrested": "^4" + "wellrested/wellrested": "^5" } } Requirements ^^^^^^^^^^^^ -- PHP 7.0 +- PHP 7.3 License ^^^^^^^