Update documentation for v5

This commit is contained in:
PJ Dietz 2020-08-16 18:03:17 -04:00
parent 84b4bce04f
commit c74a468f3e
6 changed files with 9 additions and 35 deletions

View File

@ -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)

View File

@ -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)``

View File

@ -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.

View File

@ -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

View File

@ -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/

View File

@ -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
^^^^^^^