PHPackages                             rogeriopradoj/uberloader - 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. rogeriopradoj/uberloader

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

rogeriopradoj/uberloader
========================

A way to install j4mie/uberloader via composer

0.0.1(13y ago)049BSD-2-ClausePHPPHP &gt;5.2

Since May 29Pushed 13y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Überloader
==========

[](#überloader)

A brute-force autoloader for PHP5.

Released under a [BSD license](http://en.wikipedia.org/wiki/BSD_licenses).

About
-----

[](#about)

Are you fed up of framework autoloaders that require confusing mappings between class names and file names? Annoyed about having to lay out your project in a rigorously specified structure? Or just bored of writing `require_once` dozens of times?

**Enter the Überloader**. This brute-force autoloader recursively searches your project directory, looking inside every PHP file to find where the class you're trying to use has been defined.

This might sound horribly slow, but once the Überloader has found the file, **it caches the path** so that next time you need to autoload the class, the lookup is lightning fast.

It's not pretty, it's not clean, but it works.

Let's See Some Code
-------------------

[](#lets-see-some-code)

### Concepts

[](#concepts)

Überloader has two core concepts, *search paths* and *cache backends*. Search paths are directories in which to look for files containing class definitions. Cache backends are interfaces to store file paths so they won't need to be searched again. Überloader ships with two simple cache backends; these are discussed below.

### Installation

[](#installation)

Copy the `uberloader.php` file to somewhere into your project directory and `require` it:

`require_once 'your/path/to/uberloader.php';`

### Minimal setup: convenience method

[](#minimal-setup-convenience-method)

Überloader provides a static convenience method called `init` that instantiates and registers the loader. It is suitable for simple use cases where only one path will be searched, and the basic filesystem cache backend will be used. It takes two arguments. The first is the name of the path at which to start the recursive search, and the second is the directory in which to store the cache file.

`Uberloader::init(dirname(__FILE__), dirname(__FILE__) . "/cache/");`

That's it!

### Manual setup

[](#manual-setup)

Setting up Überloader manually is quite simple. First, create an instance of the `Uberloader` class:

`$loader = new Uberloader();`

Next, we need to create a cache backend. Überloader ships with a simple filesystem-based cache backend. The constructor for this backend takes one argument: the directory in which to store the cache file.

`$backend = new UberloaderCacheBackendFilesystem(dirname(__FILE__) . "/cache/");`

You should then tell Überloader to use this backend:

`$loader->set_cache_backend($backend);`

Then, add a path to be searched for classes. This is usually the root directory of your application:

`$loader->add_path(dirname(__FILE__));`

Finally, register the autoloader. Überloader provides a helper method to do this:

`$loader->register();`

Done.

### Advanced setup

[](#advanced-setup)

#### Specifying file extensions to search

[](#specifying-file-extensions-to-search)

Überloader's constructor takes a single optional argument: an array of file extensions to search. This defaults to `array('php')`, so any files ending in `.php` will be searched.

#### Multiple search paths

[](#multiple-search-paths)

You can add multiple paths for Überloader to search by calling the `add_path` method more than once. The paths you supply will be searched in the order they are added.

This feature allows you to easily implement something like Kohana's [cascading filesystem](http://kohanaframework.org/guide/about.filesystem). Just add the search paths in a sensible order (for example: your application first, then custom modules, then the system path) and Überloader will load whichever class it finds first.

#### Disabling the cache

[](#disabling-the-cache)

During development, you may wish to disable the path cache. To do this, simply set the cache backend to be an instance of the supplied `UberloaderCacheBackendDummy`.

`$loader->set_cache_backend(new UberloaderCacheBackendDummy());`

Disabling the cache means that the whole directory tree will be searched each and every time a class is loaded, so **make sure you re-enable the cache in production**.

#### Implementing custom cache backends

[](#implementing-custom-cache-backends)

You may wish to create your own custom cache backend (for example, to store cached class paths in [Memcached](http://memcached.org/) or [Redis](http://redis.io/)). Your cache backend class should implement the `UberloaderCacheBackend` interface, which requires that it supplies three methods: `get($key)`, `set($key, $value)` and `teardown()`. The latter is called once at the end of the request and may be used to perform and necessary cleanup of your cache or connection. Of course, you may also implement a constructor to initialise your cache and any other necessary helper methods.

```
class MyCustomCacheBackend implements UberloaderCacheBackend {
    public function get($key) {
        // get the value for the specified key from your cache
    }

    public function set($key, $value) {
        // Set the given value in your cache at the specified key
    }

    public function teardown() {
        // Disconnect or save the cache
    }
}

```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.7% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4779d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/486b5f46c079c4288c6679b5d1c07300258ba21952ac9f2e14294a1261fbf8d6?d=identicon)[rogeriopradoj](/maintainers/rogeriopradoj)

---

Top Contributors

[![j4mie](https://avatars.githubusercontent.com/u/6988?v=4)](https://github.com/j4mie "j4mie (26 commits)")[![rogeriopradoj](https://avatars.githubusercontent.com/u/443391?v=4)](https://github.com/rogeriopradoj "rogeriopradoj (2 commits)")[![leemhenson](https://avatars.githubusercontent.com/u/515?v=4)](https://github.com/leemhenson "leemhenson (1 commits)")

### Embed Badge

![Health badge](/badges/rogeriopradoj-uberloader/health.svg)

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

###  Alternatives

[phing/phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.

1.2k22.2M901](/packages/phing-phing)[voku/stringy

A string manipulation library with multibyte support

1793.9M24](/packages/voku-stringy)[paulzi/yii2-nested-sets

Nested Sets Behavior for Yii2

85294.4k10](/packages/paulzi-yii2-nested-sets)[laxap/bootstrap-grids

Predefined gridelements Bootstrap 5 content elements: column grids, grids for simple accordions, and tabs.

10119.1k](/packages/laxap-bootstrap-grids)

PHPackages © 2026

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