Skip to content

Commit 4619119

Browse files
committed
docs: add doc for the namespace option to the publish command
1 parent 2f5fb07 commit 4619119

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

user_guide_src/source/libraries/publisher.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,29 @@ Most of the time you will not need to handle your own discovery, just use the pr
7575
By default on your class extension ``publish()`` will add all files from your ``$source`` and merge them
7676
out to your destination, overwriting on collision.
7777

78+
Discovery in a specific namespace
79+
---------------------------------
80+
81+
.. versionadded:: 4.6.0
82+
83+
Since v4.6.0, you can also scan a specific namespace. This not only reduces the number of files to be scanned,
84+
but also avoids the need to rerun a Publisher. All you need to do is specify the desired root namespace in the
85+
second parameter of the ``discover()`` method.
86+
87+
.. literalinclude:: publisher/016.php
88+
89+
The specified namespace must be known to CodeIgniter. You can check the list of all namespaces using the "spark namespaces" command:
90+
91+
.. code-block:: console
92+
93+
php spark namespaces
94+
95+
The "publish" command also offers the ``--namespace`` option to define the namespace when searching for Publishers that might come from a library.
96+
97+
.. code-block:: console
98+
99+
php spark publish --namespace Namespace\Vendor\Package
100+
78101
Security
79102
========
80103

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
use CodeIgniter\Publisher\Publisher;
4+
5+
$memePublishers = Publisher::discover('Publishers', 'Namespace\Vendor\Package');

0 commit comments

Comments
 (0)