Skip to content

Update 1 to 2 #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
- name: PHPStan
uses: "docker://oskarstark/phpstan-ga"
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
with:
fetch-depth: 2

Expand All @@ -79,18 +79,18 @@ jobs:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
tools: "flex"

- name: "Enforce using stable dependencies"
run: "composer config minimum-stability stable"
if: "${{ matrix.stability == 'stable' }}"

- name: "Add dependencies and enable flex"
run: |
composer require --no-update symfony/flex ${{ matrix.dependencies }}
composer config --no-plugins allow-plugins.symfony/flex true
composer require --no-update ${{ matrix.dependencies }}

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependency-versions }}"
composer-options: "${{ matrix.composer-options }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"
- name: "PHP-CS-Fixer"
uses: "docker://oskarstark/php-cs-fixer-ga:3.26.0"
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/.phpunit.result.cache
/.php_cs.cache
/.php-cs-fixer.cache
/behat.yml
/build/
/composer.lock
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee

# Version 1

# 1.34.3 - 2024-09-01

- Same as 1.34.2 but tagged on the 1.x banch instead of the feature branch.

# 1.34.2 - 2024-09-01

- More cleanup of the rate-limiter configuration. The service name is the full service name of the rate limiter, e.g. `limiter.my_name` when configuring `framework.rate_limiter.my_name`.

# 1.34.1 - 2024-09-01

- The rate-limiter name in the throttle plugin configuration is required.

# 1.34.0 - 2024-06-17

- Support to configure the throttle plugin.

# 1.33.1 - 2024-05-27

- Fixed extension to depend on the DependencyInjection component rather than the HttpKernel.

# 1.33.0 - 2024-02-27

- Support php-http/cache-plugin 2.0 and bump minimal version to 1.7 by defaulting the stream factory for cache to `httplug.psr17_stream_factory` (#448).
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,30 @@
"symfony/options-resolver": "^6.4 || ^7.1"
},
"conflict": {
"kriswallsmith/buzz": "<0.17",
"php-http/guzzle6-adapter": "<1.1",
"php-http/cache-plugin": "<1.7",
"php-http/curl-client": "<2.0",
"php-http/socket-client": "<2.0",
"kriswallsmith/buzz": "<0.17",
"php-http/react-adapter": "<3.0"
"php-http/react-adapter": "<3.0",
"php-http/throttle-plugin": "<1.1"
},
"require-dev": {
"guzzlehttp/psr7": "^1.7 || ^2.0",
"matthiasnoback/symfony-config-test": "^5.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
"nyholm/nsa": "^1.1",
"nyholm/psr7": "^1.2.1",
"php-http/cache-plugin": "^1.7",
"php-http/mock-client": "^1.2",
"php-http/promise": "^1.0",
"php-http/throttle-plugin": "^1.1",
"phpunit/phpunit": "^9",
"symfony/browser-kit": "^6.4 || ^7.1",
"symfony/cache": "^6.4 || ^7.1",
"symfony/dom-crawler": "^6.4 || ^7.1",
"symfony/framework-bundle": "^6.4 || ^7.1",
"symfony/http-foundation": "^6.4 || ^7.1",
"symfony/phpunit-bridge": "^7.1",
"symfony/stopwatch": "^6.4 || ^7.1",
"symfony/twig-bundle": "^6.4 || ^7.1",
"symfony/web-profiler-bundle": "^6.4 || ^7.1",
Expand Down Expand Up @@ -97,7 +98,7 @@
},
"prefer-stable": false,
"scripts": {
"test": "vendor/bin/simple-phpunit",
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
"test": "vendor/bin/phpunit",
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
}
}
2 changes: 2 additions & 0 deletions src/ClientFactory/AutoDiscoveryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Use auto discovery to find a HTTP client.
*
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class AutoDiscoveryFactory implements ClientFactory
{
Expand Down
2 changes: 2 additions & 0 deletions src/ClientFactory/BuzzFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class BuzzFactory implements ClientFactory
{
Expand Down
4 changes: 3 additions & 1 deletion src/ClientFactory/CurlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class CurlFactory implements ClientFactory
{
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
private readonly StreamFactoryInterface $streamFactory
private readonly StreamFactoryInterface $streamFactory,
) {
}

Expand Down
2 changes: 2 additions & 0 deletions src/ClientFactory/Guzzle6Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Guzzle6Factory implements ClientFactory
{
Expand Down
2 changes: 2 additions & 0 deletions src/ClientFactory/Guzzle7Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Guzzle7Factory implements ClientFactory
{
Expand Down
2 changes: 2 additions & 0 deletions src/ClientFactory/ReactFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class ReactFactory implements ClientFactory
{
Expand Down
2 changes: 2 additions & 0 deletions src/ClientFactory/SocketFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class SocketFactory implements ClientFactory
{
Expand Down
4 changes: 3 additions & 1 deletion src/ClientFactory/SymfonyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class SymfonyFactory implements ClientFactory
{
public function __construct(
private readonly ResponseFactoryInterface $responseFactory,
private readonly StreamFactoryInterface $streamFactory
private readonly StreamFactoryInterface $streamFactory,
) {
}

Expand Down
2 changes: 2 additions & 0 deletions src/Collector/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class Collector extends DataCollector
{
Expand Down
2 changes: 2 additions & 0 deletions src/Collector/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class Formatter implements MessageFormatter
{
Expand Down
2 changes: 1 addition & 1 deletion src/Collector/PluginClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class PluginClientFactory
public function __construct(
private readonly Collector $collector,
private readonly Formatter $formatter,
private readonly Stopwatch $stopwatch
private readonly Stopwatch $stopwatch,
) {
}

Expand Down
4 changes: 3 additions & 1 deletion src/Collector/ProfileClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfileClient implements ClientInterface, HttpAsyncClient
{
Expand All @@ -40,7 +42,7 @@ public function __construct(
$client,
private readonly Collector $collector,
private readonly Formatter $formatter,
private readonly Stopwatch $stopwatch
private readonly Stopwatch $stopwatch,
) {
if (!($client instanceof ClientInterface && $client instanceof HttpAsyncClient)) {
$client = new FlexibleHttpClient($client);
Expand Down
4 changes: 3 additions & 1 deletion src/Collector/ProfileClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfileClientFactory implements ClientFactory
{
Expand All @@ -28,7 +30,7 @@ public function __construct(
ClientFactory|callable $factory,
private readonly Collector $collector,
private readonly Formatter $formatter,
private readonly Stopwatch $stopwatch
private readonly Stopwatch $stopwatch,
) {
$this->factory = $factory;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Collector/ProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class ProfilePlugin implements Plugin
{
Expand Down Expand Up @@ -74,7 +76,7 @@ private function onException(
RequestInterface $request,
Profile $profile,
\Exception $exception,
Stack $stack
Stack $stack,
): void {
$profile->setFailed(true);
$profile->setResponse($this->formatter->formatException($exception));
Expand Down
2 changes: 2 additions & 0 deletions src/Collector/StackPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @author Fabien Bourigault <[email protected]>
*
* @internal
*
* @final
*/
class StackPlugin implements Plugin
{
Expand Down
2 changes: 2 additions & 0 deletions src/Collector/Twig/HttpMessageMarkupExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

/**
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class HttpMessageMarkupExtension extends AbstractExtension
{
Expand Down
28 changes: 27 additions & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*
* @author David Buchmann <[email protected]>
* @author Tobias Nyholm <[email protected]>
*
* @final
*/
class Configuration implements ConfigurationInterface
{
Expand Down Expand Up @@ -593,14 +595,38 @@ private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, bool $dis
->end();
// End stopwatch plugin

$error = $children->arrayNode('error')
$children->arrayNode('error')
->canBeEnabled()
->addDefaultsIfNotSet()
->children()
->scalarNode('only_server_exception')->defaultFalse()->end()
->end()
->end();
// End error plugin

$children->arrayNode('throttle')
->canBeEnabled()
->addDefaultsIfNotSet()
->children()
->scalarNode('name')
->isRequired()
->info('Rate limiter service name from symfony/rate-limiter configuration. E.g. for a rate limiter http_client you specify limiter.http_client here')
->end()
->scalarNode('key')
->defaultNull()
->info('Key to avoid sharing this rate limiter with other clients or other services. You can use the name of the client for example.')
->end()
->integerNode('tokens')
->defaultValue(1)
->info('How many tokens spending per request')
->end()
->floatNode('max_time')
->defaultNull()
->info('Maximum accepted waiting time in seconds')
->end()
->end()
->end();
// End throttle plugin
}

/**
Expand Down
Loading