PHPackages                             tomaskraus/php-includer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tomaskraus/php-includer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tomaskraus/php-includer
=======================

A minimalistic PHP library/framework for include/require

v0.4.1(9y ago)029MITPHPPHP ^5.3|^7.0

Since Aug 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tomaskraus/php-includer)[ Packagist](https://packagist.org/packages/tomaskraus/php-includer)[ Docs](https://github.com/tomaskraus/php-includer)[ RSS](/packages/tomaskraus-php-includer/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (1)Versions (14)Used By (0)

php-includer
============

[](#php-includer)

***NOTE:*** This project is ***Obsolete***. Use the [path-utils](https://github.com/tomaskraus/path-utils) library - it does one thing and does it good.

A minimalistic PHP library/framework for include/require

features
--------

[](#features)

- application root path
- smart path join
- "bootstrap" file auto include

Installation
------------

[](#installation)

Via composer:

```
composer require tomaskraus/php-includer

```

, or add this snippet to `composer.json`

```
    "require": {
        "tomaskraus/php-includer": "^0.4"
    },
```

php-includer usage options
--------------------------

[](#php-includer-usage-options)

1. **Use as a library**: Create a new `PI` (php includer) instance with your application root path as a parameter.
2. **Use as a framework**: Include `piLoader.php` in your requested page. It guesses your application root path and creates a new PI instance (a `$pi` variable) with that path guessed. It also automatically includes an user-defined "bootstrap" file (`pi.bootstrap.php`), an ideal place for your specific initialization piece of code.

### application root path guess logic

[](#application-root-path-guess-logic)

1. `piLoader.php` assumes that it is in a `vendor/tomaskraus/php-include` directory.
2. `piLoader.php` assumes that a `vendor` directory is in the application root directory.

php-includer framework examples
-------------------------------

[](#php-includer-framework-examples)

Assume we have our php application in `/var/www/myApp`. A `/var/www/myApp` is our application root path (`./`).

example 1: php-includer in the `./index.php` file

```
