8000 --- · githubfromgui/symfony-docs@121d4d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 121d4d1

Browse files
committed
---
yaml --- r: 73439 b: refs/heads/5.x c: 39f1e34 h: refs/heads/5.x i: 73437: 5438454 73435: 6df9dad 73431: 96c43c8 73423: 02c4376 73407: 712379c
1 parent 33d7424 commit 121d4d1

File tree

16 files changed

+320
-62
lines changed

16 files changed

+320
-62
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,4 @@ refs/heads/3.3: 93587037fef6a2f40e0cbdea41754e1e76255fe6
9292
refs/heads/weaverryan-patch-1: a52aee3dceba3357dd59558677811a2ff86d1357
9393
refs/heads/4.0: e887a8b5e5d102235545837506f1d4e883f051a5
9494
refs/heads/4.1: 67f3845bc17a81379c609af1944099706e5b429e
95-
refs/heads/5.x: 525078fe7ff981429c76ed4e33c788c4c8924caa
95+
refs/heads/5.x: 39f1e34626b8d1e5c68f2f3d7e93ce19affd3ec5

trunk/components/http_client.rst

Expand all lines: trunk/components/http_client.rst
Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ The HttpClient Component
1111

1212
.. versionadded:: 4.3
1313

14-
The HttpClient component was introduced in Symfony 4.3 and it's still
15-
considered an :doc:`experimental feature </contributing/code/experimental>`.
14+
The HttpClient component was introduced in Symfony 4.3.
1615

1716
Installation
1817
------------
@@ -622,15 +621,15 @@ regular expression applied to relative URLs::
622621
Interoperability
623622
----------------
624623

625-
The component is interoperable with two different abstractions for HTTP clients:
626-
`Symfony Contracts`_ and `PSR-18`_. If your application uses libraries that need
627-
any of them, the component is compatible with both. They also benefit from
628-
:ref:`autowiring aliases <service-autowiring-alias>` when the
629-
:ref:`framework bundle <framework-bundle-configuration>` is used.
624+
The component is interoperable with three different abstractions for HTTP
625+
clients: `Symfony Contracts`_, `PSR-18`_ and `HTTPlug`_ v1 and v2. If your
626+
application uses libraries that need any of them, the component is compatible
627+
with all of them. They also benefit from :ref:`autowiring aliases <service-autowiring-alias>`
628+
when the :ref:`framework bundle <framework-bundle-configuration>` is used.
630629

631630
If you are writing or maintaining a library that makes HTTP requests, you can
632631
decouple it from any specific HTTP client implementations by coding against
633-
either Symfony Contracts (recommended) or PSR-18.
632+
either Symfony Contracts (recommended) or PSR-18 (which superseded HTTPlug).
634633

635634
Symfony Contracts
636635
~~~~~~~~~~~~~~~~~
@@ -662,12 +661,14 @@ the PSR-18 abstraction, which provides none related to the transport itself.
662661
Another major feature covered by the Symfony Contracts is async/multiplexing,
663662
as described in the previous sections.
664663

665-
PSR-18
666-
~~~~~~
664+
PSR-18 and PSR-17
665+
~~~~~~~~~~~~~~~~~
667666

668667
This component implements the `PSR-18`_ (HTTP Client) specifications via the
669668
:class:`Symfony\\Component\\HttpClient\\Psr18Client` class, which is an adapter
670669
to turn a Symfony ``HttpClientInterface`` into a PSR-18 ``ClientInterface``.
670+
This class also implements the relevant methods of `PSR-17`_ to ease creating
671+
request objects.
671672

672673
To use it, you need the ``psr/http-client`` package and a `PSR-17`_ implementation:
673674

@@ -682,18 +683,72 @@ To use it, you need the ``psr/http-client`` package and a `PSR-17`_ implementati
682683
683684
Now you can make HTTP requests with the PSR-18 client as follows::
684685

685-
use Nyholm\Psr7\Factory\Psr17Factory;
686686
use Symfony\Component\HttpClient\Psr18Client;
687687

688-
$psr17Factory = new Psr17Factory();
689-
$psr18Client = new Psr18Client();
688+
$client = new Psr18Client();
690689

691690
$url = 'https://symfony.com/versions.json';
692-
$request = $psr17Factory->createRequest('GET', $url);
693-
$response = $psr18Client->sendRequest($request);
691+
$request = $client->createRequest('GET', $url);
692+
$response = $client->sendRequest($request);
694693

695694
$content = json_decode($response->getBody()->getContents(), true);
696695

696+
.. versionadded:: 4.4
697+
698+
The PSR-17 factory methods of ``Psr18Client`` were introduced in Symfony 4.4.
699+
700+
HTTPlug
701+
~~~~~~~
702+
703+
.. versionadded:: 4.4
704+
705+
Support for HTTPlug was introduced in Symfony 4.4.
706+
707+
The `HTTPlug`_ specification was published before PSR-18 and is superseded by
708+
it. As such, you should not use it in newly written code. Yet, many libraries
709+
still require v1 or v2 of it. The component is interoperable with them thanks to
710+
the ``HttplugClient`` adapter class. Similarly to ``Psr18Client`` implementing
711+
relevant parts of PSR-17, ``HttplugClient`` also implements the factory methods
712+
defined in the related ``php-http/message-factory`` package.
713+
714+
Internally, the implementation relies on the ``Psr18Client``, so that the
715+
``psr/http-client`` package is needed to use this class:
716+
717+
.. code-block:: terminal
718+
719+
# Let's suppose php-http/httplug is already required by the lib you want to use
720+
721+
# installs the PSR-18 ClientInterface
722+
$ composer require psr/http-client
723+
724+
# installs an efficient implementation of response and stream factories
725+
# with autowiring aliases provided by Symfony Flex
726+
$ composer require nyholm/psr7
727+
728+
Let's say you want to instantiate a class with the following constructor,
729+
that requires HTTPlug dependencies::
730+
731+
use Http\Client\HttpClient;
732+
use Http\Message\RequestFactory;
733+
use Http\Message\StreamFactory;
734+
735+
class SomeSdk
736+
{
737+
public function __construct(
738+
HttpClient $httpClient,
739+
RequestFactory $requestFactory,
740+
StreamFactory $streamFactory
741+
)
742+
// [...]
743+
}
744+
745+
Because ``HttplugClient`` implements the three interfaces, you can use it this way::
746+
747+
use Symfony\Component\HttpClient\HttplugClient;
748+
749+
$httpClient = new HttplugClient();
750+
$apiClient = new SomeSdk($httpClient, $httpClient, $httpClient);
751+
697752
Symfony Framework Integration
698753
-----------------------------
699754

@@ -816,4 +871,5 @@ However, using ``MockResponse`` allows simulating chunked responses and timeouts
816871
.. _`cURL PHP extension`: https://php.net/curl
817872
.. _`PSR-17`: https://www.php-fig.org/psr/psr-17/
818873
.. _`PSR-18`: https://www.php-fig.org/psr/psr-18/
874+
.. _`HTTPlug`: https://github.com/php-http/httplug/#readme
819875
.. _`Symfony Contracts`: https://github.com/symfony/contracts
trunk/components/lock.rst
Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,21 @@ Locks are used to guarantee exclusive access to some shared resource. In
2424
Symfony applications, you can use locks for example to ensure that a command is
2525
not executed more than once at the same time (on the same or different servers).
2626

27-
Locks are created using a :class:`Symfony\\Component\\Lock\\Factory` class,
27+
Locks are created using a :class:`Symfony\\Component\\Lock\\LockFactory` class,
2828
which in turn requires another class to manage the storage of locks::
2929

30-
use Symfony\Component\Lock\Factory;
30+
use Symfony\Component\Lock\LockFactory;
3131
use Symfony\Component\Lock\Store\SemaphoreStore;
3232

3333
$store = new SemaphoreStore();
34-
$factory = new Factory($store);
34+
$factory = new LockFactory($store);
3535

36-
The lock is created by calling the :method:`Symfony\\Component\\Lock\\Factory::createLock`
36+
.. versionadded:: 4.4
37+
38+
The ``Symfony\Component\Lock\LockFactory`` class was introduced in Symfony
39+
4.4. In previous versions it was called ``Symfony\Component\Lock\Factory``.
40+
41+
The lock is created by calling the :method:`Symfony\\Component\\Lock\\LockFactory::createLock`
3742
method. Its first argument is an arbitrary string that represents the locked
3843
resource. Then, a call to the :method:`Symfony\\Component\\Lock\\LockInterface::acquire`
3944
method will try to acquire the lock::
@@ -56,7 +61,7 @@ method can be safely called repeatedly, even if the lock is already acquired.
5661
Unlike other implementations, the Lock Component distinguishes locks
5762
instances even when they are created for the same resource. If a lock has
5863
to be used by several services, they should share the same ``Lock`` instance
59-
returned by the ``Factory::createLock`` method.
64+
returned by the ``LockFactory::createLock`` method.
6065

6166
.. tip::
6267

@@ -77,13 +82,13 @@ until the lock is acquired.
7782
Some of the built-in ``Store`` classes support this feature. When they don't,
7883
they can be decorated with the ``RetryTillSaveStore`` class::
7984

80-
use Symfony\Component\Lock\Factory;
85+
use Symfony\Component\Lock\LockFactory;
8186
use Symfony\Component\Lock\Store\RedisStore;
8287
use Symfony\Component\Lock\Store\RetryTillSaveStore;
8388

8489
$store = new RedisStore(new \Predis\Client('tcp://localhost:6379'));
8590
$store = new RetryTillSaveStore($store);
86-
$factory = new Factory($store);
91+
$factory = new LockFactory($store);
8792

8893
$lock = $factory->createLock('notification-flush');
8994
$lock->acquire(true);
@@ -208,8 +213,10 @@ Available Stores
208213
----------------
209214

210215
Locks are created and managed in ``Stores``, which are classes that implement
211-
:class:`Symfony\\Component\\Lock\\StoreInterface`. The component includes the
212-
following built-in store types:
216+
:class:`Symfony\\Component\\Lock\\PersistStoreInterface` and, optionally,
217+
:class:`Symfony\\Component\\Lock\\BlockingStoreInterface`.
218+
219+
The component includes the following built-in store types:
213220

214221
============================================ ====== ======== ========
215222
Store Scope Blocking Expiring
@@ -222,6 +229,12 @@ Store Scope Blocking Expiring
222229
:ref:`ZookeeperStore <lock-store-zookeeper>` remote no no
223230
============================================ ====== ======== ========
224231

232+
.. versionadded:: 4.4
233+
234+
The ``PersistStoreInterface`` and ``BlockingStoreInterface`` interfaces were
235+
introduced in Symfony 4.4. In previous versions there was only one interface
236+
called ``Symfony\Component\Lock\StoreInterface``.
237+
225238
.. _lock-store-flock:
226239

227240
FlockStore

trunk/components/mailer.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ The Mailer Component
99

1010
.. versionadded:: 4.3
1111

12-
The Mailer component was introduced in Symfony 4.3 and it's still
13-
considered an :doc:`experimental feature </contributing/code/experimental>`.
12+
The Mailer component was introduced in Symfony 4.3.
1413

1514
Installation
1615
------------

trunk/components/mime.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ The Mime Component
1111

1212
.. versionadded:: 4.3
1313

14-
The Mime component was introduced in Symfony 4.3 and it's still
15-
considered an :doc:`experimental feature </contributing/code/experimental>`.
14+
The Mime component was introduced in Symfony 4.3.
1615

1716
Installation
1817
------------

trunk/components/phpunit_bridge.rst

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,20 @@ its ``bin/simple-phpunit`` command. It has the following features:
641641

642642
The script writes the modified PHPUnit it builds in a directory that can be
643643
configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as
644-
the ``simple-phpunit`` if it is not provided.
645-
646-
It's also possible to set this env var in the ``phpunit.xml.dist`` file.
644+
the ``simple-phpunit`` if it is not provided. It's also possible to set this
645+
env var in the ``phpunit.xml.dist`` file.
646+
647+
By default, these are the PHPUnit versions used depending on the installed PHP versions:
648+
649+
===================== ===============================
650+
Installed PHP version PHPUnit version used by default
651+
===================== ===============================
652+
PHP <= 5.5 PHPUnit 4.8
653+
PHP 5.6 PHPUnit 5.7
654+
PHP 7.0 PHPUnit 6.5
655+
PHP 7.1 PHPUnit 7.5
656+
PHP >= 7.2 PHPUnit 8.2
657+
===================== ===============================
647658

648659
If you have installed the bridge through Composer, you can run it by calling e.g.:
649660

trunk/components/var_dumper.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ option. Read more about this and other options in
224224
are supported (``Ctrl. + G`` or ``Cmd. + G``, ``F3``, etc.) When
225225
finished, press ``Esc.`` to hide the box again.
226226

227+
If you want to use your browser search input, press ``Ctrl. + F`` or
228+
``Cmd. + F`` again while having focus on VarDumper's search input.
229+
230+
.. versionadded:: 4.4
231+
232+
The feature to use the browser search input was introduced in Symfony 4.4.
233+
227234
Using the VarDumper Component in your PHPUnit Test Suite
228235
--------------------------------------------------------
229236

trunk/contributing/community/releases.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ ones are considered **standard versions**:
5959
======================= ===================== ================================
6060
Version Type Bugs are fixed for... Security issues are fixed for...
6161
======================= ===================== ================================
62-
Standard 8 months 14 months
62+
Standard 8 months 8 months
6363
Long-Term Support (LTS) 3 years 4 years
6464
======================= ===================== ================================
6565

0 commit comments

Comments
 (0)
0