2017 © Pedro Peláez
 

library alias

Class alias resolving.

image

fuelphp/alias

Class alias resolving.

  • Thursday, February 26, 2015
  • by WanWizard
  • Repository
  • 4 Watchers
  • 19 Stars
  • 4,597 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 3 Forks
  • 2 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Fuel Alias

Build Status Code Coverage Quality Score HHVM Status, (*1)

Library for lazy class aliasing., (*2)

Install

Via Composer, (*3)

``` bash $ composer require fuelphp/alias, (*4)



## Usage Within FuelPHP class aliases are used to provide easy access to namespaced classes and facilitate class inheritance injection. The package exposes an alias manager which lets you create 3 types of aliases: * __Literal__<br/>A one-to-one translation. Class "Namespaced\\Classname" translates to "Another\\Classname". * __Namespace__<br/>Namespace aliases allow you to alias an entire namespace with one call. * __Replacement__<br/>A pattern is matched an through replacements a new class is generated. "Namespace\\*" maps to "Alias\\$1". When registering the alias manager append or prepends itself to the autoload stack to act as a pre-processor or fallback. Depending on the amount of aliases and it could be beneficial to alternate between pre- or appending. By default the manager will prepend itself to the autoloader stack. ### Basic Usage ```php // Create a new alias manager $manager = new Fuel\Alias\Manager; // Register the manager $manager->register(); // Alias one class $manager->alias('Alias\Me', 'To\This'); // Or alias many $manager->alias([ 'Alias\This' => 'To\Me', 'AndAlias\This' => 'To\SomethingElse', ]); //

Namespace usage

// alias to a less deep namespace
$manager->aliasNamespace('Less\Deep', 'Some\Super\Deep\Name\Space');


// alias a namespace to global
$manager->aliasNamespace('Some\Space', '');

Pattern Usage

$manager = new Fuel\Alias\Manager;

// Alias with wildcards
$manager->aliasPattern('Namespaced\*', 'Other\\$1');

$otherThing = new Namespaced\Thing;

This can result into class resolving that doesn't exists. Luckily the package is smart enough the check wether the class exists and will continue to look for the correct class if the resolved class does not exist. This is also taken into account when it comes to caching. Only resolved classes that exist will be cached., (*5)

Contributing

Thank you for considering contribution to FuelPHP framework. Please see CONTRIBUTING for details., (*6)

License

The MIT License (MIT). Please see License File for more information., (*7)

The Versions

26/02 2015

dev-master

9999999-dev https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by FuelPHP Development Team

alias aliassing

01/01 2015

2.0.0

2.0.0.0 https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by FuelPHP Development Team

alias aliassing

15/08 2013

0.2.0

0.2.0.0 https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by FuelPHP Development Team

alias aliassing

18/01 2013

0.1.2

0.1.2.0 https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by FuelPHP Development Team

alias aliassing

13/01 2013

0.1.1

0.1.1.0 https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by FuelPHP Development Team

alias aliassing

20/12 2012

0.1.0

0.1.0.0 https://github.com/fuelphp/alias

Class alias resolving.

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by FuelPHP Development Team

alias aliassing