2017 © Pedro Peláez
 

library alien

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

image

sun/alien

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  • Friday, September 18, 2015
  • by IftekherSunny
  • Repository
  • 2 Watchers
  • 2 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Alien

Build Status Total Downloads Latest Stable Version Latest Unstable Version License, (*1)

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class., (*2)

Installation Process

Just copy Alien folder somewhere into your project directory. Then include Alien autoloader., (*3)

 require_once('/path/to/Alien/autoload.php');

Alien is also available via Composer/Packagist., (*4)

 composer require sun/alien

You need to call Alien load method to initialize everything., (*5)

 Sun\AlienLoader::load();

Configuration

If you install Alien manually just open config.php file located at Alien/config.php., (*6)

If you install Alien via composer you need to publish Alien configuration file. Run this command in your terminal to publish alien configuration file., (*7)

 Php vendor/sun/alien/publish

Then, open alien.php file located at config/alien.php., (*8)

Added your alias and namespace. Like as.., (*9)

 return [
     'File' => 'Sun\FilesystemAlien',
     'Mail' => 'SunMailer\MailerAlien',
     'View' => 'SunMailer\ViewAlien'

 ];

Creating Alien

You can create Alien by extending Alien class. Here an example -, (*10)

namespace Sun;

class FilesystemAlien extends \Sun\Alien
{

    /**
     * To register Alien
     *
     * @return string namespace
     */
    public static function registerAlien()
    {
        return 'Sun\Filesystem';
    }
}

Now you can use any method of your class static way ( without creating object of your class )., (*11)

Example:

Let, Filesystem class has a method create(). Calling create method of Filesystem class -, (*12)

$filesystem = new Sun\Filesystem;
$filesystem->create();

Using Alien Now, you can also call create method by this way -, (*13)

File::create();

Testing Alien

You can test your alien class, here an example, (*14)

$mocked = File::shouldReceive('create')
                ->once()
                ->andReturn('mocked');

$this->assertEquals('mocked', $mocked); // true

Don't forget to call close method of the mockery class. Here an example for the PHPUnit testing framework, (*15)

public function tearDown()
{
    Mockery::close();
}

License

This package is licensed under the MIT License, (*16)

The Versions

18/09 2015

dev-master

9999999-dev

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

18/09 2015

v1.7

1.7.0.0

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

11/09 2015

v1.6

1.6.0.0

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

09/09 2015

v1.5

1.5.0.0

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

03/08 2015

v1.4

1.4.0.0

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

24/07 2015

v1.3

1.3.0.0

Alien helps you to create alias for your class namespace. Its also injected all the dependencies of your class.

  Sources   Download

MIT

The Requires

 

The Development Requires

alias facades alien laravel like facades php alias

21/07 2015

v1.2

1.2.0.0

This package helps you to create alias for your class namespace.

  Sources   Download

MIT

The Requires

 

alias facades alien laravel like facades php alias

15/07 2015

v1.1

1.1.0.0

This package helps you to create alias for your class namespace.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

alias facades alien laravel like facades php alias

13/07 2015

v1.0

1.0.0.0

This package helps you to create alias for your class namespace.

  Sources   Download

MIT

The Requires

  • php >=5.4.0