PHPackages                             sun/alien - 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. sun/alien

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

sun/alien
=========

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

v1.7(10y ago)257MITPHPPHP &gt;=5.4.0

Since Jul 13Pushed 10y ago2 watchersCompare

[ Source](https://github.com/IftekherSunny/Alien)[ Packagist](https://packagist.org/packages/sun/alien)[ RSS](/packages/sun-alien/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

Alien
-----

[](#alien)

[![Build Status](https://camo.githubusercontent.com/d06e1a2540aefca969860c579b106ae5e7d65d53ac1b3dc949f13fc828432812/68747470733a2f2f7472617669732d63692e6f72672f496674656b68657253756e6e792f416c69656e2e737667)](https://travis-ci.org/IftekherSunny/Alien)[![Total Downloads](https://camo.githubusercontent.com/fe56bef7f5658cc6869417754ef86b3b8b0dfe0eb4dcba0fdbaffd36c718efb4/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f616c69656e2f646f776e6c6f616473)](https://packagist.org/packages/sun/alien)[![Latest Stable Version](https://camo.githubusercontent.com/7b9a6b55e51e479b4690d61f206729825657b457815f1e7f35021cc2f0908234/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f616c69656e2f762f737461626c65)](https://packagist.org/packages/sun/alien) [![Latest Unstable Version](https://camo.githubusercontent.com/ceb0502cd6f5ae2a3a33c6918e9b16ee6da146606e7b6b67993eb4a96ee749b4/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f616c69656e2f762f756e737461626c65)](https://packagist.org/packages/sun/alien) [![License](https://camo.githubusercontent.com/74ce9f3318e742a9c30da969691d9b9af2ec7a1e31866130ac5bbc1d4c2e1b82/68747470733a2f2f706f7365722e707567782e6f72672f73756e2f616c69656e2f6c6963656e7365)](https://packagist.org/packages/sun/alien)

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

Installation Process
--------------------

[](#installation-process)

Just copy Alien folder somewhere into your project directory. Then include Alien autoloader.

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

Alien is also available via Composer/Packagist.

```
 composer require sun/alien

```

You need to call Alien load method to initialize everything.

```
 Sun\AlienLoader::load();
```

Configuration
-------------

[](#configuration)

If you install Alien manually just open config.php file located at Alien/config.php.

If you install Alien via composer you need to publish Alien configuration file. Run this command in your terminal to publish alien configuration file.

```
 Php vendor/sun/alien/publish

```

Then, open alien.php file located at config/alien.php.

Added your alias and namespace. Like as..

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

 ];
```

Creating Alien
--------------

[](#creating-alien)

You can create Alien by extending Alien class. Here an example -

```
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 ).

###### Example:

[](#example)

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

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

Using Alien Now, you can also call create method by this way -

```
File::create();
```

Testing Alien
-------------

[](#testing-alien)

You can test your alien class, here an example

```
$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

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

License
-------

[](#license)

This package is licensed under the [MIT License](https://github.com/IftekherSunny/Alien/blob/master/LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Every ~9 days

Total

8

Last Release

3896d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d233b865d7b1e1b86271e3bc70ddd077e1c01e4a83124e020fa39199c4af15a?d=identicon)[IftekherSunny](/maintainers/IftekherSunny)

---

Top Contributors

[![IftekherSunny](https://avatars.githubusercontent.com/u/8013399?v=4)](https://github.com/IftekherSunny "IftekherSunny (14 commits)")

---

Tags

aliasAlienfacadeslaravel like facadesphp alias

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sun-alien/health.svg)

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

###  Alternatives

[typo3/class-alias-loader

Amends the composer class loader to support class aliases to provide backwards compatibility for packages

4313.7M21](/packages/typo3-class-alias-loader)

PHPackages © 2026

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