PHPackages                             jetfirephp/autoload - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. jetfirephp/autoload

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

jetfirephp/autoload
===================

JetFire - Autoload support PSR-4 convention

2136PHP

Since Feb 16Pushed 10y agoCompare

[ Source](https://github.com/jetfirephp/autoload)[ Packagist](https://packagist.org/packages/jetfirephp/autoload)[ RSS](/packages/jetfirephp-autoload/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

JetFire PSR-4 Autoloader
------------------------

[](#jetfire-psr-4-autoloader)

A PSR-4 autoloader.

### Installation

[](#installation)

Via [composer](https://getcomposer.org)

```
composer require jetfirephp/autoload
```

### Usage

[](#usage)

To use the autoloader, first instantiate it, then register it with SPL autoloader stack:

```
require_once __DIR__ . '/vendor/autoload.php';

$loader = new \JetFire\Autoloader\Autoload();

$loader->register();
```

### Add Namespace

[](#add-namespace)

To add a single namespace here how to do this :

```
$loader->addNamespace('App\Admin','/path/to/app-admin/src');
$loader->addNamespace('App\Admin','/path/to/app-admin/tests');
```

For multiple namespaces :

```
$loader->setNamespaces([
    'App\Admin' => [
        '/path/to/app-admin/src',
        '/path/to/app-admin/tests'
    ],
    'App\Public' => '/path/to/app-public'
]);
// or
$loader->setNamespaces('/path/to/namespaces/file.php');
```

This will override all previous namespace settings.

### Add Class

[](#add-class)

To map a class to a file, use the `addClass()` method.

```
$loader->addClass('App/Admin/Auth','/path/to/app-admin/Auth.php');
```

For multiple classes :

```
$loader->setClassCollection([
    'App\Admin\Auth' => '/path/to/app-admin/Auth.php'
]);
// or
$loader->setClassCollection('path/to/classes/file.php');
```

### Smart Autoloader

[](#smart-autoloader)

If you set a default base directory for your autoloader like this :

```
$loader = new \JetFire\Autoloader\Autoload('/path/to/base/directory');
```

And you want to instantiate a class `Auth.php` with the namespace `App\Admin` when you have not define this namespace in `addClass()` method, JetFire\\Autoloader will check if the file `Auth.php` exists in `/path/to/base/directory/App/Admin/` folder.

### License

[](#license)

The JetFire Autoloader is released under the MIT public license : .

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6923318?v=4)[JetfirePHP](/maintainers/jetfirephp)[@jetfirephp](https://github.com/jetfirephp)

### Embed Badge

![Health badge](/badges/jetfirephp-autoload/health.svg)

```
[![Health](https://phpackages.com/badges/jetfirephp-autoload/health.svg)](https://phpackages.com/packages/jetfirephp-autoload)
```

###  Alternatives

[aura/di

A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.

352982.2k60](/packages/aura-di)[icamys/php-sitemap-generator

Simple PHP sitemap generator.

175356.9k7](/packages/icamys-php-sitemap-generator)[wyrihaximus/psr-15-cat

CAT!

124.3k2](/packages/wyrihaximus-psr-15-cat)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
