From c4a7368d043f26ad1ca510b13c112fa2ccdba74f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 29 Jun 2016 13:07:06 +0200 Subject: php-zendframework-zend-mvc-plugin-prg: 1.0.0 (New Package) --- Makefile | 3 + composer.json | 52 + makesrc.sh | 28 + php-zendframework-zend-mvc-plugin-prg.spec | 148 ++ .../.gitignore | 16 + .../.travis.yml | 86 + .../CHANGELOG.md | 49 + .../CONDUCT.md | 43 + .../CONTRIBUTING.md | 234 +++ .../LICENSE.md | 28 + .../README.md | 11 + .../composer.json | 52 + .../composer.lock | 1881 ++++++++++++++++++++ .../doc/book/index.html | 93 + .../doc/book/index.md | 1 + .../mkdocs.yml | 8 + .../phpcs.xml | 21 + .../phpunit.xml.dist | 34 + .../src/Module.php | 38 + .../src/PostRedirectGet.php | 150 ++ .../test/PostRedirectGetTest.php | 258 +++ .../test/TestAsset/SampleController.php | 20 + 22 files changed, 3254 insertions(+) create mode 100644 Makefile create mode 100644 composer.json create mode 100755 makesrc.sh create mode 100644 php-zendframework-zend-mvc-plugin-prg.spec create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.gitignore create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.travis.yml create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CHANGELOG.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONDUCT.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONTRIBUTING.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/LICENSE.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/README.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.json create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.lock create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.html create mode 120000 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.md create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/mkdocs.yml create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpcs.xml create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpunit.xml.dist create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/Module.php create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/PostRedirectGet.php create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/PostRedirectGetTest.php create mode 100644 zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/TestAsset/SampleController.php diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a2cd659 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..d7f67be --- /dev/null +++ b/composer.json @@ -0,0 +1,52 @@ +{ + "name": "zendframework/zend-mvc-plugin-prg", + "description": " ", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "mvc" + ], + "homepage": "https://github.com/zendframework/zend-mvc-plugin-prg", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "zf": { + "component": "Zend\\Mvc\\Plugin\\Prg" + } + }, + "autoload": { + "psr-4": { + "Zend\\Mvc\\Plugin\\Prg\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "ZendTest\\Mvc\\Plugin\\Prg\\": "test/" + } + }, + "require": { + "php": "^5.6 || ^7.0", + "zendframework/zend-mvc": "^3.0", + "zendframework/zend-session": "^2.6.2", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/PHPUnit": "^4.5", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "conflict": { + "zendframework/zend-mvc": "<3.0.0" + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "upload-coverage": "coveralls", + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit", + "test-coverage": "phpunit --coverage-clover clover.xml" + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..87d223d --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-zendframework-zend-mvc-plugin-prg.spec b/php-zendframework-zend-mvc-plugin-prg.spec new file mode 100644 index 0000000..5a81ae2 --- /dev/null +++ b/php-zendframework-zend-mvc-plugin-prg.spec @@ -0,0 +1,148 @@ +# remirepo/Fedora spec file for php-zendframework-zend-mvc-plugin-prg +# +# Copyright (c) 2016 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global bootstrap 0 +%global gh_commit 8c7ccb9f0004e92ff258b483447d914f42cb7448 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner zendframework +%global gh_project zend-mvc-plugin-prg +%global php_home %{_datadir}/php +%global library Prg +%if %{bootstrap} +%global with_tests 0%{?_with_tests:1} +%else +%global with_tests 0%{!?_without_tests:1} +%endif + +Name: php-%{gh_owner}-%{gh_project} +Version: 1.0.0 +Release: 1%{?dist} +Summary: Zend Framework Mvc-Plugin-%{library} component + +Group: Development/Libraries +License: BSD +URL: http://framework.zend.com/ +Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +BuildArch: noarch +# Tests +%if %{with_tests} +BuildRequires: php(language) >= 5.6 +BuildRequires: php-composer(%{gh_owner}/zend-mvc) >= 3.0 +BuildRequires: php-composer(%{gh_owner}/zend-session) >= 2.6.2 +BuildRequires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7.5 +# From composer, "require-dev": { +# "phpunit/PHPUnit": "^4.5", +# "squizlabs/php_codesniffer": "^2.3.1" +BuildRequires: php-composer(phpunit/phpunit) >= 4.5 +BuildRequires: php-composer(%{gh_owner}/zend-filter) >= 2.6.1 +BuildRequires: php-composer(%{gh_owner}/zend-form) >= 2.7 +# Autoloader +BuildRequires: php-composer(%{gh_owner}/zend-loader) >= 2.5 +%endif + +# From composer, "require": { +# "php": "^5.6 || ^7.0", +# "zendframework/zend-mvc": "^3.0", +# "zendframework/zend-session": "^2.6.2", +# "zendframework/zend-stdlib": "^2.7 || ^3.0" +Requires: php(language) >= 5.6 +Requires: php-composer(%{gh_owner}/zend-mvc) >= 3.0 +Requires: php-composer(%{gh_owner}/zend-mvc) < 4 +Requires: php-composer(%{gh_owner}/zend-session) >= 2.6.2 +Requires: php-composer(%{gh_owner}/zend-session) < 3 +Requires: php-composer(%{gh_owner}/zend-stdlib) >= 2.7 +Requires: php-composer(%{gh_owner}/zend-stdlib) < 4 +# From phpcompatinfo report for version 1.0.0 +# Nothing +%if ! %{bootstrap} +# Autoloader +Requires: php-composer(%{gh_owner}/zend-loader) >= 2.5 +%endif + +Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} + + +%description +Provides a Post-Redirect-Get controller plugin for zend-mvc versions 3.0 +and up. + +* Issues at https://github.com/zendframework/zend-mvc-plugin-prg/issues +* Documentation is at https://zendframework.github.io/zend-mvc-plugin-prg/ + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + + +%build +# Empty build section, nothing required + + +%install +rm -rf %{buildroot} + +mkdir -p %{buildroot}%{php_home}/Zend/Mvc/Plugin +cp -pr src %{buildroot}%{php_home}/Zend/Mvc/Plugin/%{library} + + +%check +%if %{with_tests} +mkdir vendor +cat << 'EOF' | tee vendor/autoload.php + array( + 'namespaces' => array( + 'ZendTest\\Mvc\\Plugin\\%{library}' => dirname(__DIR__).'/test/', + 'Zend\\Mvc\\Plugin\\%{library}' => '%{buildroot}%{php_home}/Zend/Mvc/Plugin/%{library}' +)))); +require_once '%{php_home}/Zend/autoload.php'; +EOF + +# remirepo:11 +run=0 +ret=0 +if which php56; then + php56 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1 + run=1 +fi +if which php71; then + php70 %{_bindir}/phpunit --include-path=%{buildroot}%{php_home} || ret=1 + run=1 +fi +if [ $run -eq 0 ]; then +%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} --verbose +# remirepo:2 +fi +exit $ret +%else +: Test suite disabled +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE.md +%doc CHANGELOG.md CONDUCT.md CONTRIBUTING.md README.md +%doc composer.json +%{php_home}/Zend/Mvc/Plugin/%{library} + + +%changelog +* Wed Jun 29 2016 Remi Collet - 1.0.0-1 +- initial package + diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.gitignore b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.gitignore new file mode 100644 index 0000000..673fe32 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.gitignore @@ -0,0 +1,16 @@ +.buildpath +.DS_Store +.idea +.project +.settings/ +.*.sw* +.*.un~ +nbproject +doc/html/ +tmp/ +zf-mkdoc-theme/ + +clover.xml +coveralls-upload.json +phpunit.xml +vendor diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.travis.yml b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.travis.yml new file mode 100644 index 0000000..5da404c --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/.travis.yml @@ -0,0 +1,86 @@ +sudo: false + +language: php + +branches: + except: + - /^release-.*$/ + - /^ghgfk-.*$/ + +cache: + directories: + - $HOME/.composer/cache + - $HOME/.local + - zf-mkdoc-theme + +env: + global: + - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" + - SITE_URL=https://zendframework.github.io/zend-mvc-plugin-prg + - GH_USER_NAME="Matthew Weier O'Phinney" + - GH_USER_EMAIL=matthew@weierophinney.net + - GH_REF=github.com/zendframework/zend-mvc-plugin-prg.git + - secure: "fA5rOTwEEphRdaCZ3eJBDNz5NpaO3oe8+wPjM0wdERyxQxj/eKMUQlje+TSOnlgYb/PlR5szAMJWAPrRBOuHaV2VGRAn38Ho/bTaU0tHCH4stbvg4sV4MjBYUuyclWYh7wXDs7NiwJGc0rwX5cLpSmcUD+A+cqabXFxQuzKNZrVpqHpdvMwk2uk/5DxCP+2kD4klkEEAY/wyaCY+3LBYzLU/0f9RhSAPWWAnf3XoSBCyqb2LlqzrltucDRx3h1Sy5R4CwTd90D6DIRPGIfx1sSfX9oktuv3ztUBPd3wxjfioG1mMcbFb/YC/YLqp2l0DThSEvyS26gXxhbW5M1ng9ZYH++w/Ij13tcKgKJ+aoKocpfsl1PyqpdDio8FROID8T87e6NfsgB7fevu7MepFHJwWohyu1RSqFx4lXcwviLqIxlTH8r3/yOwSUs1QRIRK05DwqF0AFL4JDkCaAlnImmaP5XPN0wf9S3Y2Od3Y2JSaW2s34T4QeoEKR5zvmRStzxVeLTlcEjRzxHr4YMYNDHWVDSelH+2RshowIwFXoKcQAX18PFJma2LTP07KmuWr9U9MRU6sXti8yVyjH+QQWzUtSndst2xXZ5lwnGNFag5pOMZnRAAAbgXSaoLnYIMiT18AmWRNTD9TE84i0NY0JwoO4xQokxy+mMGwvhEcMSk=" + +matrix: + fast_finish: true + include: + - php: 5.6 + env: + - DEPS=lowest + - php: 5.6 + env: + - DEPS=locked + - TEST_COVERAGE=true + - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)" + - PATH="$HOME/.local/bin:$PATH" + - php: 5.6 + env: + - DEPS=latest + - php: 7 + env: + - DEPS=lowest + - php: 7 + env: + - DEPS=locked + - CHECK_CS=true + - php: 7 + env: + - DEPS=latest + - php: hhvm + env: + - DEPS=lowest + - php: hhvm + env: + - DEPS=locked + - php: hhvm + env: + - DEPS=latest + allow_failures: + - php: hhvm + +notifications: + irc: "irc.freenode.org#zftalk.dev" + email: false + +before_install: + - travis_retry composer self-update + - if [[ $TRAVIS_PHP_VERSION != "hhvm" && $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini ; fi + +install: + - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi + - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --no-update --dev $COMPOSER_ARGS satooshi/php-coveralls ; fi + - travis_retry composer install $COMPOSER_ARGS + - composer show --installed + +script: + - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi + - if [[ $CHECK_CS == 'true' ]]; then composer cs-check ; fi + - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then travis_retry curl -sSL https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh | bash ; fi + +after_script: + - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer upload-coverage ; fi + +after_success: + - if [[ $DEPLOY_DOCS == "true" ]]; then ./zf-mkdoc-theme/deploy.sh ; fi diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CHANGELOG.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CHANGELOG.md new file mode 100644 index 0000000..81bef3e --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CHANGELOG.md @@ -0,0 +1,49 @@ +# Changelog + +All notable changes to this project will be documented in this file, in reverse chronological order by release. + +## 1.0.0 - 2016-05-31 + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- [#3](https://github.com/zendframework/zend-mvc-plugin-prg/pull/3) updates the + minimum PHP version to 5.6. +- [#3](https://github.com/zendframework/zend-mvc-plugin-prg/pull/3) pins the + component to zend-mvc 3.0 stable, and marks v2 releases as conflicts. + +## 0.1.0 - 2016-03-24 + +First (stable) release. + +This component replaces the `PostRedirectGet` (aka `prg()`) plugin from +zend-mvc, for use with upcoming v3 of that component. Once that stable release +is made, we will issue a 1.0.0 release removing the `dev-develop as 3.0.0` +zend-mvc constraint. + +### Added + +- Nothing. + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONDUCT.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONDUCT.md new file mode 100644 index 0000000..c663d2b --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +The Zend Framework project adheres to [The Code Manifesto](http://codemanifesto.com) +as its guidelines for contributor interactions. + +## The Code Manifesto + +We want to work in an ecosystem that empowers developers to reach their +potential — one that encourages growth and effective collaboration. A space that +is safe for all. + +A space such as this benefits everyone that participates in it. It encourages +new developers to enter our field. It is through discussion and collaboration +that we grow, and through growth that we improve. + +In the effort to create such a place, we hold to these values: + +1. **Discrimination limits us.** This includes discrimination on the basis of + race, gender, sexual orientation, gender identity, age, nationality, technology + and any other arbitrary exclusion of a group of people. +2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort + levels. Remember that, and if brought to your attention, heed it. +3. **We are our biggest assets.** None of us were born masters of our trade. + Each of us has been helped along the way. Return that favor, when and where + you can. +4. **We are resources for the future.** As an extension of #3, share what you + know. Make yourself a resource to help those that come after you. +5. **Respect defines us.** Treat others as you wish to be treated. Make your + discussions, criticisms and debates from a position of respectfulness. Ask + yourself, is it true? Is it necessary? Is it constructive? Anything less is + unacceptable. +6. **Reactions require grace.** Angry responses are valid, but abusive language + and vindictive actions are toxic. When something happens that offends you, + handle it assertively, but be respectful. Escalate reasonably, and try to + allow the offender an opportunity to explain themselves, and possibly correct + the issue. +7. **Opinions are just that: opinions.** Each and every one of us, due to our + background and upbringing, have varying opinions. The fact of the matter, is + that is perfectly acceptable. Remember this: if you respect your own + opinions, you should respect the opinions of others. +8. **To err is human.** You might not intend it, but mistakes do happen and + contribute to build experience. Tolerate honest mistakes, and don't hesitate + to apologize if you make one yourself. diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONTRIBUTING.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONTRIBUTING.md new file mode 100644 index 0000000..2b333cc --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/CONTRIBUTING.md @@ -0,0 +1,234 @@ +# CONTRIBUTING + +## RESOURCES + +If you wish to contribute to Zend Framework, please be sure to +read/subscribe to the following resources: + + - [Coding Standards](https://github.com/zendframework/zf2/wiki/Coding-Standards) + - [Contributor's Guide](http://framework.zend.com/participate/contributor-guide) + - ZF Contributor's mailing list: + Archives: http://zend-framework-community.634137.n4.nabble.com/ZF-Contributor-f680267.html + Subscribe: zf-contributors-subscribe@lists.zend.com + - ZF Contributor's IRC channel: + #zftalk.dev on Freenode.net + +If you are working on new features or refactoring [create a proposal](https://github.com/zendframework/zend-mvc-plugin-prg/issues/new). + +## Reporting Potential Security Issues + +If you have encountered a potential security vulnerability, please **DO NOT** report it on the public +issue tracker: send it to us at [zf-security@zend.com](mailto:zf-security@zend.com) instead. +We will work with you to verify the vulnerability and patch it as soon as possible. + +When reporting issues, please provide the following information: + +- Component(s) affected +- A description indicating how to reproduce the issue +- A summary of the security vulnerability and impact + +We request that you contact us via the email address above and give the project +contributors a chance to resolve the vulnerability and issue a new release prior +to any public exposure; this helps protect users and provides them with a chance +to upgrade and/or update in order to protect their applications. + +For sensitive email communications, please use [our PGP key](http://framework.zend.com/zf-security-pgp-key.asc). + +## RUNNING TESTS + +> ### Note: testing versions prior to 2.4 +> +> This component originates with Zend Framework 2. During the lifetime of ZF2, +> testing infrastructure migrated from PHPUnit 3 to PHPUnit 4. In most cases, no +> changes were necessary. However, due to the migration, tests may not run on +> versions < 2.4. As such, you may need to change the PHPUnit dependency if +> attempting a fix on such a version. + +To run tests: + +- Clone the repository: + + ```console + $ git clone git@github.com:zendframework/zend-mvc-plugin-prg.git + $ cd + ``` + +- Install dependencies via composer: + + ```console + $ curl -sS https://getcomposer.org/installer | php -- + $ ./composer.phar install + ``` + + If you don't have `curl` installed, you can also download `composer.phar` from https://getcomposer.org/ + +- Run the tests via `phpunit` and the provided PHPUnit config, like in this example: + + ```console + $ ./vendor/bin/phpunit + ``` + +You can turn on conditional tests with the phpunit.xml file. +To do so: + + - Copy `phpunit.xml.dist` file to `phpunit.xml` + - Edit `phpunit.xml` to enable any specific functionality you + want to test, as well as to provide test values to utilize. + +## Running Coding Standards Checks + +This component uses [php-cs-fixer](http://cs.sensiolabs.org/) for coding +standards checks, and provides configuration for our selected checks. +`php-cs-fixer` is installed by default via Composer. + +To run checks only: + +```console +$ ./vendor/bin/php-cs-fixer fix . -v --diff --dry-run --config-file=.php_cs +``` + +To have `php-cs-fixer` attempt to fix problems for you, omit the `--dry-run` +flag: + +```console +$ ./vendor/bin/php-cs-fixer fix . -v --diff --config-file=.php_cs +``` + +If you allow php-cs-fixer to fix CS issues, please re-run the tests to ensure +they pass, and make sure you add and commit the changes after verification. + +## Recommended Workflow for Contributions + +Your first step is to establish a public repository from which we can +pull your work into the master repository. We recommend using +[GitHub](https://github.com), as that is where the component is already hosted. + +1. Setup a [GitHub account](http://github.com/), if you haven't yet +2. Fork the repository (http://github.com/zendframework/zend-mvc-plugin-prg) +3. Clone the canonical repository locally and enter it. + + ```console + $ git clone git://github.com:zendframework/zend-mvc-plugin-prg.git + $ cd zend-mvc-plugin-prg + ``` + +4. Add a remote to your fork; substitute your GitHub username in the command + below. + + ```console + $ git remote add {username} git@github.com:{username}/zend-mvc-plugin-prg.git + $ git fetch {username} + ``` + +### Keeping Up-to-Date + +Periodically, you should update your fork or personal repository to +match the canonical ZF repository. Assuming you have setup your local repository +per the instructions above, you can do the following: + + +```console +$ git checkout master +$ git fetch origin +$ git rebase origin/master +# OPTIONALLY, to keep your remote up-to-date - +$ git push {username} master:master +``` + +If you're tracking other branches -- for example, the "develop" branch, where +new feature development occurs -- you'll want to do the same operations for that +branch; simply substitute "develop" for "master". + +### Working on a patch + +We recommend you do each new feature or bugfix in a new branch. This simplifies +the task of code review as well as the task of merging your changes into the +canonical repository. + +A typical workflow will then consist of the following: + +1. Create a new local branch based off either your master or develop branch. +2. Switch to your new local branch. (This step can be combined with the + previous step with the use of `git checkout -b`.) +3. Do some work, commit, repeat as necessary. +4. Push the local branch to your remote repository. +5. Send a pull request. + +The mechanics of this process are actually quite trivial. Below, we will +create a branch for fixing an issue in the tracker. + +```console +$ git checkout -b hotfix/9295 +Switched to a new branch 'hotfix/9295' +``` + +... do some work ... + + +```console +$ git commit +``` + +... write your log message ... + + +```console +$ git push {username} hotfix/9295:hotfix/9295 +Counting objects: 38, done. +Delta compression using up to 2 threads. +Compression objects: 100% (18/18), done. +Writing objects: 100% (20/20), 8.19KiB, done. +Total 20 (delta 12), reused 0 (delta 0) +To ssh://git@github.com/{username}/zend-mvc-plugin-prg.git + b5583aa..4f51698 HEAD -> master +``` + +To send a pull request, you have two options. + +If using GitHub, you can do the pull request from there. Navigate to +your repository, select the branch you just created, and then select the +"Pull Request" button in the upper right. Select the user/organization +"zendframework" as the recipient. + +If using your own repository - or even if using GitHub - you can use `git +format-patch` to create a patchset for us to apply; in fact, this is +**recommended** for security-related patches. If you use `format-patch`, please +send the patches as attachments to: + +- zf-devteam@zend.com for patches without security implications +- zf-security@zend.com for security patches + +#### What branch to issue the pull request against? + +Which branch should you issue a pull request against? + +- For fixes against the stable release, issue the pull request against the + "master" branch. +- For new features, or fixes that introduce new elements to the public API (such + as new public methods or properties), issue the pull request against the + "develop" branch. + +### Branch Cleanup + +As you might imagine, if you are a frequent contributor, you'll start to +get a ton of branches both locally and on your remote. + +Once you know that your changes have been accepted to the master +repository, we suggest doing some cleanup of these branches. + +- Local branch cleanup + + ```console + $ git branch -d + ``` + +- Remote branch removal + + ```console + $ git push {username} : + ``` + + +## Conduct + +Please see our [CONDUCT.md](CONDUCT.md) to understand expected behavior when interacting with others in the project. diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/LICENSE.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/LICENSE.md new file mode 100644 index 0000000..dbb1b49 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/LICENSE.md @@ -0,0 +1,28 @@ +Copyright (c) 2005-2015, Zend Technologies USA, Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +- Neither the name of Zend Technologies USA, Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/README.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/README.md new file mode 100644 index 0000000..114772e --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/README.md @@ -0,0 +1,11 @@ +# zend-mvc-plugin-prg + +[![Build Status](https://secure.travis-ci.org/zendframework/zend-mvc-plugin-prg.svg?branch=master)](https://secure.travis-ci.org/zendframework/zend-mvc-plugin-prg) +[![Coverage Status](https://coveralls.io/repos/zendframework/zend-mvc-plugin-prg/badge.svg?branch=master)](https://coveralls.io/r/zendframework/zend-mvc-plugin-prg?branch=master) + +Provides a [Post-Redirect-Get](https://en.wikipedia.org/wiki/Post/Redirect/Get) +controller plugin for [zend-mvc](https://zendframework.github.io/zend-mvc/) +versions 3.0 and up. + +- File issues at https://github.com/zendframework/zend-mvc-plugin-prg/issues +- Documentation is at https://zendframework.github.io/zend-mvc-plugin-prg/ diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.json b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.json new file mode 100644 index 0000000..d7f67be --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.json @@ -0,0 +1,52 @@ +{ + "name": "zendframework/zend-mvc-plugin-prg", + "description": " ", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "mvc" + ], + "homepage": "https://github.com/zendframework/zend-mvc-plugin-prg", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "zf": { + "component": "Zend\\Mvc\\Plugin\\Prg" + } + }, + "autoload": { + "psr-4": { + "Zend\\Mvc\\Plugin\\Prg\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "ZendTest\\Mvc\\Plugin\\Prg\\": "test/" + } + }, + "require": { + "php": "^5.6 || ^7.0", + "zendframework/zend-mvc": "^3.0", + "zendframework/zend-session": "^2.6.2", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "phpunit/PHPUnit": "^4.5", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "conflict": { + "zendframework/zend-mvc": "<3.0.0" + }, + "scripts": { + "check": [ + "@cs-check", + "@test" + ], + "upload-coverage": "coveralls", + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "test": "phpunit", + "test-coverage": "phpunit --coverage-clover clover.xml" + } +} diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.lock b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.lock new file mode 100644 index 0000000..24da454 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/composer.lock @@ -0,0 +1,1881 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "7c5e6c93b72e91dd92238e3a2ce3e2f9", + "content-hash": "95bcf09c879725dd772f4c96515b6c27", + "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "time": "2014-12-30 15:22:37" + }, + { + "name": "zendframework/zend-config", + "version": "2.6.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-config.git", + "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-config/zipball/2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d", + "reference": "2920e877a9f6dca9fa8f6bd3b1ffc2e19bb1e30d", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-i18n": "^2.5", + "zendframework/zend-json": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" + }, + "suggest": { + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-i18n": "Zend\\I18n component", + "zendframework/zend-json": "Zend\\Json to use the Json reader or writer classes", + "zendframework/zend-servicemanager": "Zend\\ServiceManager for use with the Config Factory to retrieve reader and writer instances" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Config\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a nested object property based user interface for accessing this configuration data within application code", + "homepage": "https://github.com/zendframework/zend-config", + "keywords": [ + "config", + "zf2" + ], + "time": "2016-02-04 23:01:10" + }, + { + "name": "zendframework/zend-escaper", + "version": "2.5.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-escaper.git", + "reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73", + "reference": "a4b227d8a477f4e7e9073f8e0a7ae7dbd3104a73", + "shasum": "" + }, + "require": { + "php": ">=5.3.23" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Escaper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-escaper", + "keywords": [ + "escaper", + "zf2" + ], + "time": "2015-06-03 14:05:37" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/5c80bdee0e952be112dcec0968bad770082c3a6e", + "reference": "5c80bdee0e952be112dcec0968bad770082c3a6e", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2016-02-18 20:53:00" + }, + { + "name": "zendframework/zend-http", + "version": "2.5.4", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-http.git", + "reference": "7b920b4ec34b5ee58f76eb4e8c408b083121953c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-http/zipball/7b920b4ec34b5ee58f76eb4e8c408b083121953c", + "reference": "7b920b4ec34b5ee58f76eb4e8c408b083121953c", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-loader": "^2.5", + "zendframework/zend-stdlib": "^2.5 || ^3.0", + "zendframework/zend-uri": "^2.5", + "zendframework/zend-validator": "^2.5" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.0", + "zendframework/zend-config": "^2.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Http\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests", + "homepage": "https://github.com/zendframework/zend-http", + "keywords": [ + "http", + "zf2" + ], + "time": "2016-02-04 20:36:48" + }, + { + "name": "zendframework/zend-loader", + "version": "2.5.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-loader.git", + "reference": "c5fd2f071bde071f4363def7dea8dec7393e135c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-loader/zipball/c5fd2f071bde071f4363def7dea8dec7393e135c", + "reference": "c5fd2f071bde071f4363def7dea8dec7393e135c", + "shasum": "" + }, + "require": { + "php": ">=5.3.23" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Loader\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-loader", + "keywords": [ + "loader", + "zf2" + ], + "time": "2015-06-03 14:05:47" + }, + { + "name": "zendframework/zend-modulemanager", + "version": "2.7.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-modulemanager.git", + "reference": "2a59ab9a0dd7699a55050dff659ab0f28272b46e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-modulemanager/zipball/2a59ab9a0dd7699a55050dff659ab0f28272b46e", + "reference": "2a59ab9a0dd7699a55050dff659ab0f28272b46e", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-config": "^2.6", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-console": "^2.6", + "zendframework/zend-di": "^2.6", + "zendframework/zend-loader": "^2.5", + "zendframework/zend-mvc": "^2.7", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3" + }, + "suggest": { + "zendframework/zend-config": "Zend\\Config component", + "zendframework/zend-console": "Zend\\Console component", + "zendframework/zend-loader": "Zend\\Loader component", + "zendframework/zend-mvc": "Zend\\Mvc component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\ModuleManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-modulemanager", + "keywords": [ + "modulemanager", + "zf2" + ], + "time": "2016-05-16 21:21:11" + }, + { + "name": "zendframework/zend-mvc", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-mvc.git", + "reference": "af8c5bf21a7f5f61e997797b514a7c31c5a00b9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-mvc/zipball/af8c5bf21a7f5f61e997797b514a7c31c5a00b9a", + "reference": "af8c5bf21a7f5f61e997797b514a7c31c5a00b9a", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": "^5.6 || ^7.0", + "zendframework/zend-eventmanager": "^3.0", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-modulemanager": "^2.7.1", + "zendframework/zend-router": "^3.0.1", + "zendframework/zend-servicemanager": "^3.0.3", + "zendframework/zend-stdlib": "^3.0", + "zendframework/zend-view": "^2.6.7" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.5", + "zendframework/zend-json": "^2.6.1 || ^3.0", + "zendframework/zend-psr7bridge": "^0.2" + }, + "suggest": { + "zendframework/zend-json": "(^2.6.1 || ^3.0) To auto-deserialize JSON body content in AbstractRestfulController extensions, when json_decode is unavailable", + "zendframework/zend-mvc-console": "zend-mvc-console provides the ability to expose zend-mvc as a console application", + "zendframework/zend-mvc-i18n": "zend-mvc-i18n provides integration with zend-i18n, including a translation bridge and translatable route segments", + "zendframework/zend-mvc-plugin-fileprg": "To provide Post/Redirect/Get functionality around forms that container file uploads", + "zendframework/zend-mvc-plugin-flashmessenger": "To provide flash messaging capabilities between requests", + "zendframework/zend-mvc-plugin-identity": "To access the authenticated identity (per zend-authentication) in controllers", + "zendframework/zend-mvc-plugin-prg": "To provide Post/Redirect/Get functionality within controllers", + "zendframework/zend-psr7bridge": "(^0.2) To consume PSR-7 middleware within the MVC workflow", + "zendframework/zend-servicemanager-di": "zend-servicemanager-di provides utilities for integrating zend-di and zend-servicemanager in your zend-mvc application" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Mvc\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-mvc", + "keywords": [ + "mvc", + "zf2" + ], + "time": "2016-05-31 19:27:09" + }, + { + "name": "zendframework/zend-router", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-router.git", + "reference": "03763610632a9022aff22a0e8f340852e68392a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-router/zipball/03763610632a9022aff22a0e8f340852e68392a1", + "reference": "03763610632a9022aff22a0e8f340852e68392a1", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": "^5.5 || ^7.0", + "zendframework/zend-http": "^2.5", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-stdlib": "^2.7.5 || ^3.0" + }, + "conflict": { + "zendframework/zend-mvc": "<3.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5", + "sebastian/version": "^1.0.4", + "squizlabs/php_codesniffer": "^2.3", + "zendframework/zend-i18n": "^2.6" + }, + "suggest": { + "zendframework/zend-i18n": "^2.6, if defining translatable HTTP path segments" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + }, + "zf": { + "component": "Zend\\Router", + "config-provider": "Zend\\Router\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Router\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-router", + "keywords": [ + "mvc", + "routing", + "zf2" + ], + "time": "2016-05-31 20:47:48" + }, + { + "name": "zendframework/zend-servicemanager", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-servicemanager.git", + "reference": "654eaec084d053c832beca10a53af078afca423e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-servicemanager/zipball/654eaec084d053c832beca10a53af078afca423e", + "reference": "654eaec084d053c832beca10a53af078afca423e", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.0", + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "ocramius/proxy-manager": "~1.0", + "phpbench/phpbench": "^0.10.0", + "phpunit/phpunit": "~4.6", + "squizlabs/php_codesniffer": "^2.0@dev" + }, + "suggest": { + "ocramius/proxy-manager": "ProxyManager 1.* to handle lazy initialization of services", + "zendframework/zend-stdlib": "zend-stdlib ^2.5 if you wish to use the MergeReplaceKey or MergeRemoveKey features in Config instances" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\ServiceManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-servicemanager", + "keywords": [ + "service-manager", + "servicemanager", + "zf" + ], + "time": "2016-02-02 14:13:42" + }, + { + "name": "zendframework/zend-session", + "version": "2.7.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-session.git", + "reference": "79002c7b3e83477217121936c2577526f15555b1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-session/zipball/79002c7b3e83477217121936c2577526f15555b1", + "reference": "79002c7b3e83477217121936c2577526f15555b1", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "container-interop/container-interop": "^1.1", + "fabpot/php-cs-fixer": "1.7.*", + "mongodb/mongodb": "^1.0.1", + "phpunit/phpunit": "~4.0", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-db": "^2.7", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-validator": "^2.6" + }, + "suggest": { + "mongodb/mongodb": "If you want to use the MongoDB session save handler", + "zendframework/zend-cache": "Zend\\Cache component", + "zendframework/zend-db": "Zend\\Db component", + "zendframework/zend-http": "Zend\\Http component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", + "zendframework/zend-validator": "Zend\\Validator component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + }, + "zf": { + "component": "Zend\\Session", + "config-provider": "Zend\\Session\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Session\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "manage and preserve session data, a logical complement of cookie data, across multiple page requests by the same client", + "homepage": "https://github.com/zendframework/zend-session", + "keywords": [ + "session", + "zf2" + ], + "time": "2016-05-11 17:01:53" + }, + { + "name": "zendframework/zend-stdlib", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "8bafa58574204bdff03c275d1d618aaa601588ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/8bafa58574204bdff03c275d1d618aaa601588ae", + "reference": "8bafa58574204bdff03c275d1d618aaa601588ae", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "~0.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev", + "dev-develop": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2016-04-12 21:19:36" + }, + { + "name": "zendframework/zend-uri", + "version": "2.5.2", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-uri.git", + "reference": "0bf717a239432b1a1675ae314f7c4acd742749ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/0bf717a239432b1a1675ae314f7c4acd742749ed", + "reference": "0bf717a239432b1a1675ae314f7c4acd742749ed", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-escaper": "^2.5", + "zendframework/zend-validator": "^2.5" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Uri\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "a component that aids in manipulating and validating » Uniform Resource Identifiers (URIs)", + "homepage": "https://github.com/zendframework/zend-uri", + "keywords": [ + "uri", + "zf2" + ], + "time": "2016-02-17 22:38:51" + }, + { + "name": "zendframework/zend-validator", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-validator.git", + "reference": "f956581bc5fa4cf3f2933fe24e77deded8d1937b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-validator/zipball/f956581bc5fa4cf3f2933fe24e77deded8d1937b", + "reference": "f956581bc5fa4cf3f2933fe24e77deded8d1937b", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "php": "^5.5 || ^7.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.0", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-config": "^2.6", + "zendframework/zend-db": "^2.7", + "zendframework/zend-filter": "^2.6", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-i18n": "^2.6", + "zendframework/zend-math": "^2.6", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-session": "^2.6.2", + "zendframework/zend-uri": "^2.5" + }, + "suggest": { + "zendframework/zend-db": "Zend\\Db component", + "zendframework/zend-filter": "Zend\\Filter component, required by the Digits validator", + "zendframework/zend-i18n": "Zend\\I18n component to allow translation of validation error messages as well as to use the various Date validators", + "zendframework/zend-i18n-resources": "Translations of validator messages", + "zendframework/zend-math": "Zend\\Math component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component to allow using the ValidatorPluginManager and validator chains", + "zendframework/zend-session": "Zend\\Session component", + "zendframework/zend-uri": "Zend\\Uri component, required by the Uri and Sitemap\\Loc validators" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev", + "dev-develop": "2.9-dev" + }, + "zf": { + "component": "Zend\\Validator", + "config-provider": "Zend\\Validator\\ConfigProvider" + } + }, + "autoload": { + "psr-4": { + "Zend\\Validator\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a set of commonly needed validators", + "homepage": "https://github.com/zendframework/zend-validator", + "keywords": [ + "validator", + "zf2" + ], + "time": "2016-05-16 13:39:40" + }, + { + "name": "zendframework/zend-view", + "version": "2.7.0", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-view.git", + "reference": "001336925fec6bb36e8e6d2b2af60da30a9d087e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-view/zipball/001336925fec6bb36e8e6d2b2af60da30a9d087e", + "reference": "001336925fec6bb36e8e6d2b2af60da30a9d087e", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "zendframework/zend-eventmanager": "^2.6.2 || ^3.0", + "zendframework/zend-loader": "^2.5", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "^4.5", + "zendframework/zend-authentication": "^2.5", + "zendframework/zend-cache": "^2.6.1", + "zendframework/zend-config": "^2.6", + "zendframework/zend-console": "^2.6", + "zendframework/zend-escaper": "^2.5", + "zendframework/zend-feed": "^2.7", + "zendframework/zend-filter": "^2.6.1", + "zendframework/zend-http": "^2.5.4", + "zendframework/zend-i18n": "^2.6", + "zendframework/zend-json": "^2.6.1", + "zendframework/zend-log": "^2.7", + "zendframework/zend-modulemanager": "^2.7.1", + "zendframework/zend-mvc": "^2.7", + "zendframework/zend-navigation": "^2.5", + "zendframework/zend-paginator": "^2.5", + "zendframework/zend-permissions-acl": "^2.6", + "zendframework/zend-router": "^3.0.1", + "zendframework/zend-serializer": "^2.6.1", + "zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3", + "zendframework/zend-session": "^2.6.2", + "zendframework/zend-uri": "^2.5" + }, + "suggest": { + "zendframework/zend-authentication": "Zend\\Authentication component", + "zendframework/zend-escaper": "Zend\\Escaper component", + "zendframework/zend-feed": "Zend\\Feed component", + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-http": "Zend\\Http component", + "zendframework/zend-i18n": "Zend\\I18n component", + "zendframework/zend-json": "Zend\\Json component", + "zendframework/zend-mvc": "Zend\\Mvc component", + "zendframework/zend-navigation": "Zend\\Navigation component", + "zendframework/zend-paginator": "Zend\\Paginator component", + "zendframework/zend-permissions-acl": "Zend\\Permissions\\Acl component", + "zendframework/zend-servicemanager": "Zend\\ServiceManager component", + "zendframework/zend-uri": "Zend\\Uri component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev", + "dev-develop": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\View\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides a system of helpers, output filters, and variable escaping", + "homepage": "https://github.com/zendframework/zend-view", + "keywords": [ + "view", + "zf2" + ], + "time": "2016-05-12 14:24:52" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14 21:17:01" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2015-02-03 12:10:50" + }, + { + "name": "phpspec/prophecy", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3c91bdf81797d725b14cb62906f9a4ce44235972", + "reference": "3c91bdf81797d725b14cb62906f9a4ce44235972", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpspec/phpspec": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2016-02-15 07:46:21" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06 15:47:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-06-21 13:08:43" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21 13:50:34" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2016-05-12 18:03:57" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2015-09-15 10:49:45" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.26", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fc1d8cd5b5de11625979125c5639347896ac2c74", + "reference": "fc1d8cd5b5de11625979125c5639347896ac2c74", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.1", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2016-05-17 03:09:28" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2015-10-02 06:51:40" + }, + { + "name": "sebastian/comparator", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", + "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2015-07-26 15:48:44" + }, + { + "name": "sebastian/diff", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", + "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2015-12-08 07:14:41" + }, + { + "name": "sebastian/environment", + "version": "1.3.7", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", + "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-05-17 03:18:57" + }, + { + "name": "sebastian/exporter", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2015-06-21 07:55:53" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12 03:26:01" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2015-11-11 19:50:13" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21 13:59:46" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.6.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "reference": "fb72ed32f8418db5e7770be1653e62e0d6f5dd3d", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2016-05-30 22:24:32" + }, + { + "name": "symfony/yaml", + "version": "v3.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "reference": "eca51b7b65eb9be6af88ad7cc91685f1556f5c9a", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2016-05-26 21:46:24" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^5.6 || ^7.0" + }, + "platform-dev": [] +} diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.html b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.html new file mode 100644 index 0000000..64f69c9 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.html @@ -0,0 +1,93 @@ +
+
+

zend-mvc-plugin-prg

+ +

Post/Redirect/Get plugin for zend-mvc controllers.

+ +
$ composer require zendframework/zend-mvc-plugin-prg
+
+
+ +
+
+
+
+
+

Installation

+
+ +
+

+ Install via composer: +

+ +

+$ composer require zendframework/zend-mvc-plugin-prg
+          
+ +

+ If you are using the zend-component-installer, + you're done! +

+ +

+ If not, you will need to add the component as a module to your + application. Add the entry 'Zend\Mvc\Plugin\Prg' to + your list of modules in your application configuration (typically + one of config/application.config.php or + config/modules.config.php). +

+
+
+
+ +
+

Usage

+ +

+ When a user sends a POST request (e.g. after submitting a form), their + browser will try to protect them from sending the POST again, breaking + the back button, causing browser warnings and pop-ups, and sometimes + reposting the form. Instead, when receiving a POST, we should store the + data in a session container and redirect the user to a GET request. +

+ +

This plugin can be invoked with two arguments:

+ +
    +
  • $redirect, a string containing the redirect location, + which can either be a named route or a URL, based on the contents of + the second parameter.
  • +
  • $redirectToUrl, a boolean that when set to + TRUE, causes the first parameter to be treated as a URL + instead of a route name (this is required when redirecting to a URL + instead of a route). This argument defaults to FALSE.
  • +
+ +

When no arguments are provided, the current matched route is used.

+ +

Example Usage

+ +

+// Pass in the route/url you want to redirect to after the POST
+$prg = $this->prg('/user/register', true);
+
+if ($prg instanceof \Zend\Http\PhpEnvironment\Response) {
+    // Returned a response to redirect us.
+    return $prg;
+}
+
+if ($prg === false) {
+    // This wasn't a POST request, but there were no params in the flash
+    // messenger; this is probably the first time the form was loaded.
+    return ['form' => $myForm];
+}
+
+// $prg is an array containing the POST params from the previous request
+$form->setData($prg);
+
+// ... your form processing code here
+      
+
+
+
diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.md b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.md new file mode 120000 index 0000000..fe84005 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/doc/book/index.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/mkdocs.yml b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/mkdocs.yml new file mode 100644 index 0000000..204b5be --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/mkdocs.yml @@ -0,0 +1,8 @@ +docs_dir: doc/book +site_dir: doc/html +pages: + - index.md +site_name: zend-mvc-plugin-prg +site_description: 'zend-mvc-plugin-prg: Post-Redirect-Get controller plugin for zend-mvc' +repo_url: 'https://github.com/zendframework/zend-mvc-plugin-prg' +copyright: 'Copyright (c) 2016 Zend Technologies USA Inc.' diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpcs.xml b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpcs.xml new file mode 100644 index 0000000..e994eae --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpcs.xml @@ -0,0 +1,21 @@ + + + Zend Framework coding standard + + + + + + + + + + + + + + + + src + test + diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpunit.xml.dist b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpunit.xml.dist new file mode 100644 index 0000000..36e8b8a --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/phpunit.xml.dist @@ -0,0 +1,34 @@ + + + + + ./test/ + + + + + + disable + + + + + + ./src + + + + + + + + + + + diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/Module.php b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/Module.php new file mode 100644 index 0000000..cc4345b --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/Module.php @@ -0,0 +1,38 @@ + [ + 'aliases' => [ + 'prg' => PostRedirectGet::class, + 'PostRedirectGet' => PostRedirectGet::class, + 'postRedirectGet' => PostRedirectGet::class, + 'postredirectget' => PostRedirectGet::class, + 'Zend\Mvc\Controller\Plugin\PostRedirectGet' => PostRedirectGet::class, + ], + 'factories' => [ + PostRedirectGet::class => InvokableFactory::class, + ], + ], + ]; + } +} diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/PostRedirectGet.php b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/PostRedirectGet.php new file mode 100644 index 0000000..9a6279b --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/src/PostRedirectGet.php @@ -0,0 +1,150 @@ +getController(); + $request = $controller->getRequest(); + $container = $this->getSessionContainer(); + + if ($request->isPost()) { + $container->setExpirationHops(1, 'post'); + $container->post = $request->getPost()->toArray(); + return $this->redirect($redirect, $redirectToUrl); + } + + if (null !== $container->post) { + $post = $container->post; + unset($container->post); + return $post; + } + + return false; + } + + /** + * @return Container + */ + public function getSessionContainer() + { + if (! $this->sessionContainer) { + $this->sessionContainer = new Container('prg_post1'); + } + return $this->sessionContainer; + } + + /** + * @param Container $container + * @return PostRedirectGet + */ + public function setSessionContainer(Container $container) + { + $this->sessionContainer = $container; + return $this; + } + + /** + * TODO: Good candidate for traits method in PHP 5.4 with FilePostRedirectGet plugin + * + * @param string $redirect + * @param bool $redirectToUrl + * @return \Zend\Http\Response + * @throws RuntimeException if route-based redirection is requested, but no + * plugin manager is composed in the controller. + */ + protected function redirect($redirect, $redirectToUrl) + { + $controller = $this->getController(); + $params = []; + $options = ['query' => $controller->params()->fromQuery()]; + $reuseMatchedParams = false; + + if (null === $redirect) { + $routeMatch = $controller->getEvent()->getRouteMatch(); + + $redirect = $routeMatch->getMatchedRouteName(); + // null indicates to redirect to self. + $reuseMatchedParams = true; + } + + $redirector = $this->marshalRedirectPlugin($controller, $redirectToUrl); + + // Redirect to route-based URL + if (false === $redirectToUrl) { + $response = $redirector->toRoute($redirect, $params, $options, $reuseMatchedParams); + $response->setStatusCode(303); + return $response; + } + + // Redirect to specific URL + $response = $redirector->toUrl($redirect); + $response->setStatusCode(303); + + return $response; + } + + /** + * Marshal a redirect plugin instance. + * + * @param DispatchableInterface $controller + * @param bool $redirectToUrl + * @return Redirect + * @throws RuntimeException if route-based redirection is requested, but no + * plugin manager is composed in the controller. + */ + private function marshalRedirectPlugin(DispatchableInterface $controller, $redirectToUrl) + { + if (method_exists($controller, 'getPluginManager')) { + // get the redirect plugin from the plugin manager + return $controller->getPluginManager()->get('Redirect'); + } + + // If the user wants to redirect to a route, the redirector has to come + // from the plugin manager; otherwise no router will be injected + if (false === $redirectToUrl) { + throw new RuntimeException('Could not redirect to a route without a router'); + } + + return new Redirect(); + } +} diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/PostRedirectGetTest.php b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/PostRedirectGetTest.php new file mode 100644 index 0000000..d0538d5 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/PostRedirectGetTest.php @@ -0,0 +1,258 @@ +addRoute('home', LiteralRoute::factory([ + 'route' => '/', + 'defaults' => [ + 'controller' => TestAsset\SampleController::class, + ] + ])); + + $router->addRoute('sub', SegmentRoute::factory([ + 'route' => '/foo/:param', + 'defaults' => [ + 'param' => 1 + ] + ])); + + $router->addRoute('ctl', SegmentRoute::factory([ + 'route' => '/ctl/:controller', + 'defaults' => [ + '__NAMESPACE__' => 'ZendTest\Mvc\Plugin\Prg\TestAsset', + 'controller' => 'sample' + ] + ])); + + $this->controller = new TestAsset\SampleController(); + $this->request = new Request(); + $this->event = new MvcEvent(); + $this->routeMatch = new RouteMatch(['controller' => 'controller-sample', 'action' => 'postPage']); + + $this->event->setRequest($this->request); + $this->event->setRouteMatch($this->routeMatch); + $this->event->setRouter($router); + + $this->controller->setEvent($this->event); + + $this->plugin = new PostRedirectGet(); + $this->plugin->setController($this->controller); + } + + public function testReturnsFalseOnInitialGet() + { + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $this->assertFalse($plugin('home')); + } + + public function testRedirectsToUrlOnPost() + { + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters([ + 'postval1' => 'value' + ])); + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultUrl = $plugin('/test/getPage', true); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultUrl); + $this->assertTrue($prgResultUrl->getHeaders()->has('Location')); + $this->assertEquals('/test/getPage', $prgResultUrl->getHeaders()->get('Location')->getUri()); + $this->assertEquals(303, $prgResultUrl->getStatusCode()); + } + + public function testRedirectsToRouteOnPost() + { + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters([ + 'postval1' => 'value1' + ])); + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin('home'); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals('/', $prgResultRoute->getHeaders()->get('Location')->getUri()); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + } + + public function testReturnsPostOnRedirectGet() + { + $params = [ + 'postval1' => 'value1' + ]; + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters($params)); + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin('home'); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals('/', $prgResultRoute->getHeaders()->get('Location')->getUri()); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + + // Do GET + $this->request = new Request(); + $this->controller->dispatch($this->request, $this->response); + $prgResult = $plugin('home'); + + $this->assertEquals($params, $prgResult); + + // Do GET again to make sure data is empty + $this->request = new Request(); + $this->controller->dispatch($this->request, $this->response); + $prgResult = $plugin('home'); + + $this->assertFalse($prgResult); + } + + public function testThrowsExceptionOnRouteWithoutRouter() + { + $controller = $this->controller; + $controller = $controller->getEvent()->setRouter(new SimpleRouteStack); + + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters([ + 'postval1' => 'value' + ])); + $this->controller->dispatch($this->request, $this->response); + + $this->setExpectedException(RuntimeException::class); + $plugin = $this->plugin; + $prgResultRoute = $plugin('some/route'); + } + + public function testNullRouteUsesMatchedRouteName() + { + $this->controller->getEvent()->getRouteMatch()->setMatchedRouteName('home'); + + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters([ + 'postval1' => 'value1' + ])); + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin(); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals('/', $prgResultRoute->getHeaders()->get('Location')->getUri()); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + } + + public function testReuseMatchedParameters() + { + $this->controller->getEvent()->getRouteMatch()->setMatchedRouteName('sub'); + + $this->request->setMethod('POST'); + $this->request->setPost(new Parameters([ + 'postval1' => 'value1' + ])); + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin(); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals('/foo/1', $prgResultRoute->getHeaders()->get('Location')->getUri()); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + } + + public function testReuseMatchedParametersWithSegmentController() + { + $expects = '/ctl/sample'; + $this->request->setMethod('POST'); + $this->request->setUri($expects); + $this->request->setPost(new Parameters([ + 'postval1' => 'value1' + ])); + + $routeMatch = $this->event->getRouter()->match($this->request); + $this->event->setRouteMatch($routeMatch); + + $moduleRouteListener = new ModuleRouteListener; + $moduleRouteListener->onRoute($this->event); + + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin(); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals( + $expects, + $prgResultRoute->getHeaders()->get('Location')->getUri(), + 'expects to redirect for the same url' + ); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + } + + public function testKeepUrlQueryParameters() + { + $expects = '/ctl/sample'; + $this->request->setMethod('POST'); + $this->request->setUri($expects); + $this->request->setQuery(new Parameters([ + 'id' => '123', + ])); + + $routeMatch = $this->event->getRouter()->match($this->request); + $this->event->setRouteMatch($routeMatch); + + $moduleRouteListener = new ModuleRouteListener; + $moduleRouteListener->onRoute($this->event); + + $this->controller->dispatch($this->request, $this->response); + + $plugin = $this->plugin; + $prgResultRoute = $plugin(); + + $this->assertInstanceOf('Zend\Http\Response', $prgResultRoute); + $this->assertTrue($prgResultRoute->getHeaders()->has('Location')); + $this->assertEquals( + $expects . '?id=123', + $prgResultRoute->getHeaders()->get('Location')->getUri(), + 'expects to redirect for the same url' + ); + $this->assertEquals(303, $prgResultRoute->getStatusCode()); + } +} diff --git a/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/TestAsset/SampleController.php b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/TestAsset/SampleController.php new file mode 100644 index 0000000..f44f240 --- /dev/null +++ b/zend-mvc-plugin-prg-8c7ccb9f0004e92ff258b483447d914f42cb7448/test/TestAsset/SampleController.php @@ -0,0 +1,20 @@ +