diff --git a/.gitignore b/.gitignore index d3db2080..53e74c8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ doc/html/ vendor/ +zf-mkdoc-theme/ clover.xml composer.lock coveralls-upload.json +zf-mkdoc-theme.tgz diff --git a/.travis.yml b/.travis.yml index 139d6beb..8b82d792 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,17 @@ language: php cache: directories: - $HOME/.composer/cache + - $HOME/.local - vendor + - zf-mkdoc-theme + +env: + global: + - SITE_URL: https://zendframework.github.io/zend-expressive + - GH_USER_NAME: "Matthew Weier O'Phinney" + - GH_USER_EMAIL: matthew@weierophinney.net + - GH_REF: github.com/zendframework/zend-expressive.git + - secure: "C3RfQG69KAbqQqyQAgF6LhPvIpy5zSk0XnILvGEbcDoB36gg6/OcEHFCfFGdDZdSc3itDwwt65eiCVvKC4K5deuvqbCR1gAHAacYpW4jDV4fVaO40eiqZmQ7BZ1LHBQssJsa46yd0lwMmnj7V1Gya8MhD7ga5LINUe6ZxGzgo2Y3XRSWUzYcIiiGbCXXTgix8yG4de+Z5batsx0aT+99E0+U0DVB+DGoVaWRNwOY0UNdggTaKG0ahPJczlMsMsXyafop7LVAsYdIvaYoOMC8gshB/tket+q0b+61i9zaDtQv+x0oWvkobyDksr24jYkLAKMMQGFBq1cVJElVbNHSdtY0dLunpnQn9iaZ8PW8IhIw83YeyR9KPgbX3bF9SRt+Eay2j/YB2RbNK5BG2c/NeidnflMjcjPEhA4Ab6f0N1vy9wex5w/FAJUrhpfQB6AZgIJ/wovnJJAvF1etBSfZ0CYA+oAzYRRFQXo5Eq+lxvX5mQ2w2+sv6sUBS0IoP+1+JKzR98k2pi+q+4HhVVPH28aRfr8PTR/YRCmcUK68H7OKWf8h1vuJYjtN3V5FBOhlej8N9cYqQUBj4YpITqYP0PdzE1iUOoDpZVBMlWqxYw1vKhNiWusMCdJlI1psGWNs9t7hrMpJCg9eRWCe16akEoRrZGreU53ekFZpgeEQgGI=" matrix: fast_finish: true @@ -13,36 +23,41 @@ matrix: - php: 5.5 env: - EXECUTE_CS_CHECK=true - - EXECUTE_DOC_CHECK=true - php: 5.6 env: - EXECUTE_TEST_COVERALLS=true + - DEPLOY_DOCS=true - php: 7 - - php: hhvm + - php: hhvm allow_failures: - php: hhvm before_install: + - export PATH="$HOME/.local/bin:$PATH" - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi - composer self-update - - if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then composer require --dev --no-update phly/bookdown2mkdocs ; fi - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls:dev-master ; fi install: - travis_retry composer install --no-interaction - composer info -i -before_script: - - if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then cp mkdocs.yml mkdocs.yml.orig ; fi - script: - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer test-coverage ; fi - if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then composer test ; fi - if [[ $EXECUTE_CS_CHECK == 'true' ]]; then composer cs ; fi - - if [[ $EXECUTE_DOC_CHECK == 'true' ]]; then make mkdocs ; diff mkdocs.yml mkdocs.yml.orig ; return $? ; fi after_script: - if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer coveralls ; fi +after_success: + - export DEPLOY=$(if [[ $DEPLOY_DOCS == 'true' && $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n "true" ; else echo -n "false" ; fi) + - export NEEDS_THEME=$([ -d zf-mkdoc-theme/theme ] ; result=$? ; if (( result == 0 )); then echo -n "false"; else echo -n "true" ; fi) + - if [[ $DEPLOY == "true" ]]; then pip install --user mkdocs ; fi + - if [[ $DEPLOY == "true" ]]; then pip install --user pymdown-extensions ; fi + - if [[ $DEPLOY == "true" && $NEEDS_THEME == "true" ]]; then echo "Downloading zf-mkdoc-theme" ; $(if [[ ! -d zf-mkdoc-theme ]];then mkdir zf-mkdoc-theme ; fi) ; $(curl -s -L https://github.com/zendframework/zf-mkdoc-theme/releases/latest | egrep -o '/zendframework/zf-mkdoc-theme/archive/[0-9]*\.[0-9]*\.[0-9]*.tar.gz' | head -n1 | wget -O zf-mkdoc-theme.tgz --base=https://github.com/ -i -) ; $(cd zf-mkdoc-theme ; tar xzf ../zf-mkdoc-theme.tgz --strip-components=1) ; echo "Finished downloading and installing zf-mkdoc-theme" ; fi + - export CAN_DEPLOY=$([ -f zf-mkdoc-theme/deploy.sh ] ; result=$? ; if (( result == 0 )); then echo -n "true"; else echo -n "false" ; fi) + - if [[ $DEPLOY == "true" && $CAN_DEPLOY == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; else echo "Missing deployment script" ; fi + notifications: email: true diff --git a/Makefile b/Makefile deleted file mode 100644 index 56d507c0..00000000 --- a/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# zend-expressive Makefile -# -# Primary purpose is for generating the mkdocs.yml from the bookdown.json -# sources. -# -# Configurable variables: -# - BOOKDOWN2MKDOCS - specify the path to the executable; defaults to -# ./vendor/bin/bookdown2mkdocs -# -# Available targets: -# - mkdocs - regenerate mkdocs.yml -# - all - synonym for mkdocs target - -BOOKDOWN2MKDOCS?=$(CURDIR)/vendor/bin/bookdown2mkdocs.php - -.PHONY : all mkdocs bookdown2mkdocs - -all : mkdocs - -mkdocs : - @echo "Generating mkdocs.yml from bookdown.json..." - -$(BOOKDOWN2MKDOCS) convert --site-name=zend-expressive --repo-url=https://github.com/zendframework/zend-expressive --copyright-url=http://www.zend.com/ --copyright-author="Zend Technologies USA Inc." - @echo "[DONE] Generating mkdocs.yml from bookdown.json" diff --git a/README.md b/README.md index 4a3f0507..b1d09716 100644 --- a/README.md +++ b/README.md @@ -83,20 +83,14 @@ documentation. ## Documentation -Documentation is [in the doc tree](doc/), and can be compiled using [bookdown](http://bookdown.io): +Documentation is [in the doc tree](doc/book/), and can be compiled using [mkdocs](http://www.mkdocs.org): ```bash -$ bookdown doc/bookdown.json -$ php -S 0.0.0.0:8080 -t doc/html/ # then browse to http://localhost:8080/ +$ mkdocs build ``` -> ### Bookdown -> -> You can install bookdown globally using `composer global require bookdown/bookdown`. If you do -> this, make sure that `$HOME/.composer/vendor/bin` is on your `$PATH`. - Additionally, public-facing, browseable documentation is available at -http://zend-expressive.rtfd.org. +https://zendframework.github.io/zend-expressive/ ## Architecture diff --git a/doc/book/container/bookdown.json b/doc/book/container/bookdown.json deleted file mode 100644 index f3ec1bbc..00000000 --- a/doc/book/container/bookdown.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "Containers", - "content": [ - {"Introduction": "intro.md"}, - {"Container Factories": "factories.md"}, - {"Using zend-servicemanager": "zend-servicemanager.md"}, - {"Using Pimple": "pimple.md"}, - {"Using Aura.Di": "aura-di.md"} - ] -} diff --git a/doc/book/cookbook/bookdown.json b/doc/book/cookbook/bookdown.json deleted file mode 100644 index 52cb5269..00000000 --- a/doc/book/cookbook/bookdown.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "title": "Cookbook", - "content": [ - {"Prepending a common path to all routes": "common-prefix-for-routes.md"}, - {"Route-specific middleware pipelines": "route-specific-pipeline.md"}, - {"Setting custom 404 page handling": "custom-404-page-handling.md"}, - {"Registering custom view helpers when using zend-view": "using-custom-view-helpers.md"}, - {"Using zend-form view helpers": "using-zend-form-view-helpers.md"}, - {"Using Expressive from a subdirectory": "using-a-base-path.md"}, - {"Building modular applications": "modular-layout.md"}, - {"Setting a locale based on a routing parameter": "setting-locale-depending-routing-parameter.md"}, - {"Setting a locale without a routing parameter": "setting-locale-without-routing-parameter.md"}, - {"Enabling debug toolbars": "debug-toolbars.md"}, - {"Handling multiple routes in a single class": "using-routed-middleware-class-as-controller.md"} - ] -} diff --git a/doc/book/cookbook/common-prefix-for-routes.md b/doc/book/cookbook/common-prefix-for-routes.md index 5a8e2bf8..e04f5f7b 100644 --- a/doc/book/cookbook/common-prefix-for-routes.md +++ b/doc/book/cookbook/common-prefix-for-routes.md @@ -19,7 +19,7 @@ As your application progresses, you may have a mixture of different content, and the above segregated under the path `/api`. This is essentially the same problem as addressed in the -["Segregating your application to a subpath"](../usage-examples.md#segregating-your-application-to-a-subpath) example. +["Segregating your application to a subpath"](../reference/usage-examples.md#segregating-your-application-to-a-subpath) example. To accomplish it: diff --git a/doc/book/cookbook/custom-404-page-handling.md b/doc/book/cookbook/custom-404-page-handling.md index 04ea4ade..89937bc7 100644 --- a/doc/book/cookbook/custom-404-page-handling.md +++ b/doc/book/cookbook/custom-404-page-handling.md @@ -1,7 +1,7 @@ # How can I set custom 404 page handling? In some cases, you may want to handle 404 errors separately from the -[final handler](../error-handling.md). This can be done by registering +[final handler](../features/error-handling.md). This can be done by registering middleware that operates late — specifically, after the routing middleware. Such middleware will be executed if no other middleware has executed, and/or when all other middleware calls `return $next()` @@ -78,7 +78,7 @@ that does not rely on the final handler. ## Registering custom 404 handlers We can register either `Application\NotFound` class above as service in the -[service container](../container/intro.md). In the case of the second approach, +[service container](../features/container/intro.md). In the case of the second approach, you would also need to provide a factory for creating the middleware (to ensure you inject the template renderer). diff --git a/doc/book/application.md b/doc/book/features/application.md similarity index 100% rename from doc/book/application.md rename to doc/book/features/application.md diff --git a/doc/book/container/aura-di.md b/doc/book/features/container/aura-di.md similarity index 100% rename from doc/book/container/aura-di.md rename to doc/book/features/container/aura-di.md diff --git a/doc/book/container/factories.md b/doc/book/features/container/factories.md similarity index 100% rename from doc/book/container/factories.md rename to doc/book/features/container/factories.md diff --git a/doc/book/container/intro.md b/doc/book/features/container/intro.md similarity index 100% rename from doc/book/container/intro.md rename to doc/book/features/container/intro.md diff --git a/doc/book/container/pimple.md b/doc/book/features/container/pimple.md similarity index 100% rename from doc/book/container/pimple.md rename to doc/book/features/container/pimple.md diff --git a/doc/book/container/zend-servicemanager.md b/doc/book/features/container/zend-servicemanager.md similarity index 100% rename from doc/book/container/zend-servicemanager.md rename to doc/book/features/container/zend-servicemanager.md diff --git a/doc/book/emitters.md b/doc/book/features/emitters.md similarity index 100% rename from doc/book/emitters.md rename to doc/book/features/emitters.md diff --git a/doc/book/error-handling.md b/doc/book/features/error-handling.md similarity index 100% rename from doc/book/error-handling.md rename to doc/book/features/error-handling.md diff --git a/doc/book/helpers/body-parse.md b/doc/book/features/helpers/body-parse.md similarity index 100% rename from doc/book/helpers/body-parse.md rename to doc/book/features/helpers/body-parse.md diff --git a/doc/book/helpers/intro.md b/doc/book/features/helpers/intro.md similarity index 100% rename from doc/book/helpers/intro.md rename to doc/book/features/helpers/intro.md diff --git a/doc/book/helpers/server-url-helper.md b/doc/book/features/helpers/server-url-helper.md similarity index 100% rename from doc/book/helpers/server-url-helper.md rename to doc/book/features/helpers/server-url-helper.md diff --git a/doc/book/helpers/url-helper.md b/doc/book/features/helpers/url-helper.md similarity index 100% rename from doc/book/helpers/url-helper.md rename to doc/book/features/helpers/url-helper.md diff --git a/doc/book/router/aura.md b/doc/book/features/router/aura.md similarity index 100% rename from doc/book/router/aura.md rename to doc/book/features/router/aura.md diff --git a/doc/book/router/fast-route.md b/doc/book/features/router/fast-route.md similarity index 100% rename from doc/book/router/fast-route.md rename to doc/book/features/router/fast-route.md diff --git a/doc/book/router/interface.md b/doc/book/features/router/interface.md similarity index 100% rename from doc/book/router/interface.md rename to doc/book/features/router/interface.md diff --git a/doc/book/router/intro.md b/doc/book/features/router/intro.md similarity index 100% rename from doc/book/router/intro.md rename to doc/book/features/router/intro.md diff --git a/doc/book/router/piping.md b/doc/book/features/router/piping.md similarity index 100% rename from doc/book/router/piping.md rename to doc/book/features/router/piping.md diff --git a/doc/book/router/result-observers.md b/doc/book/features/router/result-observers.md similarity index 100% rename from doc/book/router/result-observers.md rename to doc/book/features/router/result-observers.md diff --git a/doc/book/router/uri-generation.md b/doc/book/features/router/uri-generation.md similarity index 100% rename from doc/book/router/uri-generation.md rename to doc/book/features/router/uri-generation.md diff --git a/doc/book/router/zf2.md b/doc/book/features/router/zf2.md similarity index 100% rename from doc/book/router/zf2.md rename to doc/book/features/router/zf2.md diff --git a/doc/book/template/interface.md b/doc/book/features/template/interface.md similarity index 100% rename from doc/book/template/interface.md rename to doc/book/features/template/interface.md diff --git a/doc/book/template/intro.md b/doc/book/features/template/intro.md similarity index 100% rename from doc/book/template/intro.md rename to doc/book/features/template/intro.md diff --git a/doc/book/template/middleware.md b/doc/book/features/template/middleware.md similarity index 100% rename from doc/book/template/middleware.md rename to doc/book/features/template/middleware.md diff --git a/doc/book/template/plates.md b/doc/book/features/template/plates.md similarity index 100% rename from doc/book/template/plates.md rename to doc/book/features/template/plates.md diff --git a/doc/book/template/twig.md b/doc/book/features/template/twig.md similarity index 100% rename from doc/book/template/twig.md rename to doc/book/features/template/twig.md diff --git a/doc/book/template/zend-view.md b/doc/book/features/template/zend-view.md similarity index 100% rename from doc/book/template/zend-view.md rename to doc/book/features/template/zend-view.md diff --git a/doc/book/features.md b/doc/book/getting-started/features.md similarity index 97% rename from doc/book/features.md rename to doc/book/getting-started/features.md index 9f39ea76..1ecd4bd7 100644 --- a/doc/book/features.md +++ b/doc/book/getting-started/features.md @@ -69,7 +69,7 @@ features it provides include: Below is a diagram detailing the workflow used by Expressive. -![Expressive Architectural Flow](images/architecture.png) +![Expressive Architectural Flow](../images/architecture.png) The `Application` acts as an "onion"; in the diagram above, the top is the outer-most layer of the onion, while the bottom is the inner-most. @@ -151,7 +151,7 @@ will execute in one of two conditions: - routed middleware called on the next middleware instead of returning a response. As such, the largest use case for such middleware is for error handling. -One possibility is for [providing custom 404 handling](cookbook/custom-404-page-handling.md), +One possibility is for [providing custom 404 handling](../cookbook/custom-404-page-handling.md), or handling application-specific error conditions (such as authentication or authorization failures). diff --git a/doc/book/quick-start-skeleton.md b/doc/book/getting-started/skeleton.md similarity index 97% rename from doc/book/quick-start-skeleton.md rename to doc/book/getting-started/skeleton.md index 601289c5..a51638a9 100644 --- a/doc/book/quick-start-skeleton.md +++ b/doc/book/getting-started/skeleton.md @@ -271,7 +271,7 @@ Congratulations! You've now created your application, and started writing middleware! It's time to start learning about the rest of the features of Expressive: -- [Containers](container/intro.md) -- [Routing](router/intro.md) -- [Templating](template/intro.md) -- [Error Handling](error-handling.md) +- [Containers](../features/container/intro.md) +- [Routing](../features/router/intro.md) +- [Templating](../features/template/intro.md) +- [Error Handling](../features/error-handling.md) diff --git a/doc/book/quick-start.md b/doc/book/getting-started/standalone.md similarity index 90% rename from doc/book/quick-start.md rename to doc/book/getting-started/standalone.md index 12bf701a..936f8c58 100644 --- a/doc/book/quick-start.md +++ b/doc/book/getting-started/standalone.md @@ -2,7 +2,7 @@ Expressive allows you to get started at your own pace. You can start with the simplest example, detailed below, or move on to a more structured, -configuration-driven approach as detailed in the [use case examples](usage-examples.md). +configuration-driven approach as detailed in the [use case examples](../reference/usage-examples.md). ## 1. Create a new project directory @@ -113,10 +113,10 @@ http://localhost:8080/ to see if your application responds correctly! At this point, you have a working zend-expressive application, that responds to a single route. From here, you may want to read up on: -- [Applications](application.md) -- [Containers](container/intro.md) -- [Routing](router/intro.md) -- [Templating](template/intro.md) -- [Error Handling](error-handling.md) +- [Applications](../features/application.md) +- [Containers](../features/container/intro.md) +- [Routing](../features/router/intro.md) +- [Templating](../features/template/intro.md) +- [Error Handling](../features/error-handling.md) -Additionally, we have more [use case examples](usage-examples.md). +Additionally, we have more [use case examples](../reference/usage-examples.md). diff --git a/doc/book/helpers/bookdown.json b/doc/book/helpers/bookdown.json deleted file mode 100644 index 61f2c583..00000000 --- a/doc/book/helpers/bookdown.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "title": "Helpers", - "content": [ - {"Introduction": "intro.md"}, - {"UrlHelper": "url-helper.md"}, - {"ServerUrlHelper": "server-url-helper.md"}, - {"Body Parsing Middleware": "body-parse.md"} - ] -} diff --git a/doc/book/images/checkmark.png b/doc/book/images/checkmark.png new file mode 100644 index 00000000..e2107e55 Binary files /dev/null and b/doc/book/images/checkmark.png differ diff --git a/doc/book/images/installer.png b/doc/book/images/installer.png new file mode 100644 index 00000000..c662e24b Binary files /dev/null and b/doc/book/images/installer.png differ diff --git a/doc/book/images/lambda.png b/doc/book/images/lambda.png new file mode 100644 index 00000000..f17f9e0a Binary files /dev/null and b/doc/book/images/lambda.png differ diff --git a/doc/book/images/nodes.png b/doc/book/images/nodes.png new file mode 100644 index 00000000..84f2566f Binary files /dev/null and b/doc/book/images/nodes.png differ diff --git a/doc/book/images/pencil.png b/doc/book/images/pencil.png new file mode 100644 index 00000000..3313b44a Binary files /dev/null and b/doc/book/images/pencil.png differ diff --git a/doc/book/images/syringe.png b/doc/book/images/syringe.png new file mode 100644 index 00000000..969ed4e8 Binary files /dev/null and b/doc/book/images/syringe.png differ diff --git a/doc/book/images/warning.png b/doc/book/images/warning.png new file mode 100644 index 00000000..b43e2890 Binary files /dev/null and b/doc/book/images/warning.png differ diff --git a/doc/book/index.html b/doc/book/index.html new file mode 100644 index 00000000..01595ca9 --- /dev/null +++ b/doc/book/index.html @@ -0,0 +1,171 @@ +
PSR-7 Middleware in Minutes
++ Create middleware + applications, using as many layers as you want, and the architecture + your project needs. +
++ Make your code flexible and robust, using the + dependency injection container of your choice. +
++ Handle errors gracefully, using + templated error pages, whoops, + or your own solution! +
+Installation is only a Composer command away!
+ +
+$ composer create-project -s rc zendframework/zend-expressive-skeleton expressive
+
+
+ + Expressive provides interfaces for routing and templating, letting you + choose what to use, and how you want to implement it. +
+ ++ Our unique installer allows you to select your choices when starting + your project! +
+ +Write middleware:
+ +
+$pathMiddleware = function (
+ ServerRequestInterface $request,
+ ResponseInterface $response,
+ callable $next
+) {
+ $uri = $request->getUri();
+ $path = $uri->getPath();
+
+ $response->getBody()->write('You visited ' . $path);
+ return $next($request, $response->withHeader('X-Path', $path));
+};
+
+
+ And add it to an application:
+ +
+$app->get('/path', $pathMiddleware);
+
+ Or use the menu to navigate to the section you're interested in.
+