2017 © Pedro Peláez
 

library aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

image

uestla/aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  • Thursday, May 29, 2014
  • by uestla
  • Repository
  • 2 Watchers
  • 3 Stars
  • 436 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Aliaser

Simple PHP library for parsing and handling class and function aliases defined by USE statements., (*1)

Usage

Book.php, (*2)

Here we have an entity class Book with some annotations:, (*3)

namespace Model\Entities;

use \DateTime;

/**
 * @property User $author
 * @property DateTime $written
 */
class Book
{}

function foo()
{}

foo.php, (*4)

And now let's say we would like to take those annotations and get the full class name of those @property types defined. And that's where we'll use Aliaser:, (*5)

$reflection = new ReflectionClass('Model\Entities\Book');

Aliaser\Container::getClass('User', $reflection); // 'Model\Entities\User'
Aliaser\Container::getClass('DateTime', $reflection); // 'DateTime'

We can discover full function/callback name according to given namespace context as well., (*6)

Aliaser\Container::getCallback('DateTime::format', $reflection); // 'DateTime::format'
Aliaser\Container::getCallback('User::getName', $reflection); // 'Model\Entities\User::getName'

Aliaser\Container::getCallback('foo', $reflection); // 'Model\Entities\foo'

It handles multiple namespace definitions in a single file as well., (*7)

However, parsing can be quite expensive - we can use a Nette Framework Cache:, (*8)

$storage = new Nette\Caching\Storages\FileStorage(__DIR__ . '/temp');
Aliaser\Container::setCacheStorage($storage);

// ...

Enjoy., (*9)

The Versions

29/05 2014

dev-master

9999999-dev https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

14/08 2013

1.1.0

1.1.0.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

26/07 2013

1.0.5

1.0.5.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

18/07 2013

1.0.4

1.0.4.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

18/07 2013

1.0.3

1.0.3.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

11/07 2013

1.0.2

1.0.2.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

02/07 2013

1.0.1

1.0.1.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace

30/06 2013

1.0.0

1.0.0.0 https://github.com/uestla/Aliaser

Simple PHP library for parsing and handling class aliases defined by USE statements.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php namespace