Skip to content

Commit

Permalink
migrate packages from zendframework to laminas and mezzio
Browse files Browse the repository at this point in the history
  • Loading branch information
Lansoweb committed Jan 2, 2020
1 parent e567eaf commit fbb05dc
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 64 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
117 changes: 62 additions & 55 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
4 changes: 2 additions & 2 deletions src/Exception/ReachedRateLimit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/RateLimitMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/RateLimitMiddlewareFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Psr\Container\ContainerInterface;
use Psr\SimpleCache\CacheInterface;
use Zend\ProblemDetails\ProblemDetailsResponseFactory;
use Mezzio\ProblemDetails\ProblemDetailsResponseFactory;

class RateLimitMiddlewareFactory
{
Expand Down
6 changes: 3 additions & 3 deletions test/RateLimitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit fbb05dc

Please sign in to comment.