Skip to content

Commit

Permalink
docs: add doc for the namespace option to the publish command
Browse files Browse the repository at this point in the history
  • Loading branch information
dimtrovich committed Nov 14, 2024
1 parent 2f5fb07 commit 8b8e89c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
23 changes: 23 additions & 0 deletions user_guide_src/source/libraries/publisher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,29 @@ Most of the time you will not need to handle your own discovery, just use the pr
By default on your class extension ``publish()`` will add all files from your ``$source`` and merge them
out to your destination, overwriting on collision.

Discovery in a specific namespace
---------------------------------

.. versionadded:: 4.6.0

Since v4.6.0, you can also scan a specific namespace. This not only reduces the number of files to be scanned,
but also avoids the need to rerun a Publisher. All you need to do is specify the desired root namespace in the
second parameter of the ``discover()`` method.

.. literalinclude:: publisher/016.php

The specified namespace must be known to CodeIgniter. You can check the list of all namespaces using the "spark namespaces" command:

.. code-block:: console
php spark namespaces
The "publish" command also offers the ``--namespace`` option to define the namespace when searching for Publishers that might come from a library.

.. code-block:: console
php spark publish --namespace Namespace\Vendor\Package
Security
========

Expand Down
5 changes: 5 additions & 0 deletions user_guide_src/source/libraries/publisher/016.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

use CodeIgniter\Publisher\Publisher;

$memePublishers = Publisher::discover('Publishers', 'Namespace\Vendor\Package');

0 comments on commit 8b8e89c

Please sign in to comment.