xp_dir_include

xp_dir_include($dir[, $listen = false[, $path = false]])

Recursively includes all .php files in the given directory.

Listeners can be started automatically by passing $listen as true.

param string:Directory to include.
param boolean:Start listeners.
param string:Path to ignore when starting listeners.
rtype:void .. note:

Listener class names are generated compliant to PSR-4 with the directory serving as the top-level namespace.

Example #1 Basic Usage

xp_dir_include('Foo');

With the directory structure.

- Foo/
    - Bar.php

Will include the file Foo/Bar.php

Example #2 Listeners

xp_include_dir('Foo', true);

With the directory structure.

- Foo/
    - Bar.php
    - Bar/
        - Hello_World.php

Will include the files Foo/Bar.php, Foo/Bar/Hello_World.php and attempt to start classes Foo\Bar, Foo\Bar\Hello_World.

Note

Listeners must extend the XPSPL\Listener class.

<?php
namespace Foo\Bar;

Class Hello_World extends \XPSPL\Listener {

    // Do something on the 'foo' signal
    public function on_foo(\XPSPL\SIG $signal) {
        echo 'foobar';
    }

}

When the XP_SIG('foo') signal is emitted the Hello_World->on_foo method will be executed.

Read the Docs v: v5.0.1
Versions
latest
v5.0.1
v5.0.0
v4.0.1
v4.0.0
v3.1.1
v3.1.0
v3.0.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.