diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec4780..5c1c7af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,28 @@ All notable changes to this project will be documented in this file, in reverse chronological order by release. +## 3.1.0 - 2020-01-02 + +### Added + +- Nothing. + +### Changed + +- migrate packages from zendframework to laminas + +### Deprecated + +- Nothing. + +### Removed + +- Nothing. + +### Fixed + +- Nothing. + ## 3.0.0 - 2019-07-15 ### Added diff --git a/README.md b/README.md index c95e1ea..ef55280 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,10 @@ Just add the middleware as one of the first middlewares. The provided factory uses the container to get a \Psr\SimpleCache\CacheInterface (PSR-16). Most implementations provide both PSR-6 and PSR-16, or at least a decorator. -Recommended: [zend-cache](https://github.com/zendframework/zend-cache) or [symfony/cache](https://github.com/symfony/cache). +Recommended: [zend-cache](https://github.com/laminas/laminas-cache) or [symfony/cache](https://github.com/symfony/cache). ### Zend Expressive -If you are using [expressive-skeleton](https://github.com/zendframework/zend-expressive-skeleton), +If you are using [expressive-skeleton](https://github.com/mezzio/mezzio-skeleton), you can copy `config/los-rate-limit.local.php.dist` to `config/autoload/los-rate-limit.local.php` and modify configuration as your needs. diff --git a/composer.json b/composer.json index 11cb718..363789e 100644 --- a/composer.json +++ b/composer.json @@ -1,58 +1,65 @@ { - "name" : "los/los-rate-limit", - "description" : "Rate Limit Middleware for PHP", - "require" : { - "php" : "^7.1", - "psr/http-message" : "^1.0", - "psr/container": "^1.0", - "psr/http-server-middleware": "^1.0", - "zendframework/zend-problem-details": "^1.0", - "zendframework/zend-diactoros": "^1.8.6 || ^2.0", - "psr/simple-cache": "^1.0" - }, - "require-dev" : { - "phpunit/phpunit" : "^7.0 || ^8.0", - "squizlabs/php_codesniffer": "^3.4", - "php-coveralls/php-coveralls": "^2.1", - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.12" - }, - "license" : "BSD-3-Clause", - "keywords" : [ "api", "rate", "limit", "middleware" ], - "autoload-dev" : { - "psr-4" : { - "LosMiddlewareTest\\RateLimit\\" : "tests/" - } - }, - "autoload" : { - "psr-4" : { - "LosMiddleware\\RateLimit\\" : "src/" - } - }, - "type" : "library", - "config": { - "sort-packages": true - }, - "support" : { - "email" : "leandro@leandrosilva.info", - "source" : "https://github.com/LansoWeb/LosRateLimit", - "issues" : "https://github.com/LansoWeb/LosRateLimit/issues" - }, - "homepage" : "https://github.com/LansoWeb/LosRateLimit", - "authors" : [ { - "name" : "Leandro Silva", - "email" : "leandro@leandrosilva.info" - } ], - "scripts": { - "check": [ - "@cs-check", - "@phpstan" + "name": "los/los-rate-limit", + "description": "Rate Limit Middleware for PHP", + "require": { + "php": "^7.1", + "psr/http-message": "^1.0", + "psr/container": "^1.0", + "psr/http-server-middleware": "^1.0", + "mezzio/mezzio-problem-details": "^1.0", + "laminas/laminas-diactoros": "^1.8.6 || ^2.0", + "psr/simple-cache": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.0 || ^8.0", + "squizlabs/php_codesniffer": "^3.4", + "php-coveralls/php-coveralls": "^2.1", + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.12" + }, + "license": "BSD-3-Clause", + "keywords": [ + "api", + "rate", + "limit", + "middleware" ], - "cs-check": "phpcs", - "cs-fix": "phpcbf", - "phpstan": "phpstan analyse -l max -c phpstan.neon src", - "test": "phpunit --colors=always", - "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", - "upload-coverage": "php-coveralls -v" - } + "autoload-dev": { + "psr-4": { + "LosMiddlewareTest\\RateLimit\\": "tests/" + } + }, + "autoload": { + "psr-4": { + "LosMiddleware\\RateLimit\\": "src/" + } + }, + "type": "library", + "config": { + "sort-packages": true + }, + "support": { + "email": "leandro@leandrosilva.info", + "source": "https://github.com/LansoWeb/LosRateLimit", + "issues": "https://github.com/LansoWeb/LosRateLimit/issues" + }, + "homepage": "https://github.com/LansoWeb/LosRateLimit", + "authors": [ + { + "name": "Leandro Silva", + "email": "leandro@leandrosilva.info" + } + ], + "scripts": { + "check": [ + "@cs-check", + "@phpstan" + ], + "cs-check": "phpcs", + "cs-fix": "phpcbf", + "phpstan": "phpstan analyse -l max -c phpstan.neon src", + "test": "phpunit --colors=always", + "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", + "upload-coverage": "php-coveralls -v" + } } diff --git a/src/Exception/ReachedRateLimit.php b/src/Exception/ReachedRateLimit.php index 63af4f5..f3bd206 100644 --- a/src/Exception/ReachedRateLimit.php +++ b/src/Exception/ReachedRateLimit.php @@ -5,8 +5,8 @@ namespace LosMiddleware\RateLimit\Exception; use Exception; -use Zend\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait; -use Zend\ProblemDetails\Exception\ProblemDetailsExceptionInterface; +use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait; +use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface; use function sprintf; class ReachedRateLimit extends Exception implements ProblemDetailsExceptionInterface diff --git a/src/RateLimitMiddleware.php b/src/RateLimitMiddleware.php index 603f31a..de2bc74 100644 --- a/src/RateLimitMiddleware.php +++ b/src/RateLimitMiddleware.php @@ -12,7 +12,7 @@ use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; use Psr\SimpleCache\CacheInterface; -use Zend\ProblemDetails\ProblemDetailsResponseFactory; +use Mezzio\ProblemDetails\ProblemDetailsResponseFactory; use const FILTER_VALIDATE_IP; use function array_key_exists; use function array_map; diff --git a/src/RateLimitMiddlewareFactory.php b/src/RateLimitMiddlewareFactory.php index 12150d9..a383bf6 100644 --- a/src/RateLimitMiddlewareFactory.php +++ b/src/RateLimitMiddlewareFactory.php @@ -6,7 +6,7 @@ use Psr\Container\ContainerInterface; use Psr\SimpleCache\CacheInterface; -use Zend\ProblemDetails\ProblemDetailsResponseFactory; +use Mezzio\ProblemDetails\ProblemDetailsResponseFactory; class RateLimitMiddlewareFactory { diff --git a/test/RateLimitTest.php b/test/RateLimitTest.php index d15381b..a78b609 100644 --- a/test/RateLimitTest.php +++ b/test/RateLimitTest.php @@ -8,9 +8,9 @@ use PHPUnit\Framework\TestCase; use Psr\Http\Server\RequestHandlerInterface; use Psr\SimpleCache\CacheInterface; -use Zend\Diactoros\Response\JsonResponse; -use Zend\Diactoros\ServerRequest; -use Zend\ProblemDetails\ProblemDetailsResponseFactory; +use Laminas\Diactoros\Response\JsonResponse; +use Laminas\Diactoros\ServerRequest; +use Mezzio\ProblemDetails\ProblemDetailsResponseFactory; class RateLimitTest extends TestCase {