PHPackages                             techdev-solutions/exar - 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. [Framework](/categories/framework)
4. /
5. techdev-solutions/exar

ActiveLibrary[Framework](/categories/framework)

techdev-solutions/exar
======================

EXAR - an AOP Framework for PHP

v0.1.0(11y ago)28786[1 issues](https://github.com/techdev-solutions/exar-framework/issues)[1 PRs](https://github.com/techdev-solutions/exar-framework/pulls)MITPHPPHP &gt;=5.3

Since Jan 9Pushed 10y ago11 watchersCompare

[ Source](https://github.com/techdev-solutions/exar-framework)[ Packagist](https://packagist.org/packages/techdev-solutions/exar)[ Docs](http://www.exarphp.com)[ RSS](/packages/techdev-solutions-exar/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

exar-framework
==============

[](#exar-framework)

A lightweight AOP layer for PHP.

Installation
------------

[](#installation)

The simplest way to use Exar is to install it via Composer.

Create a `composer.json` file in your project root and define the dependency:

```
{
    "require": {
        "techdev-solutions/exar": "dev-master"
    },
    "minimum-stability": "dev"
}

```

Install Composer in your project:

```
curl -s http://getcomposer.org/installer | php

```

Tell Composer to download and install the dependencies:

```
php composer.phar install

```

Now you are ready to code with Exar!

Creating a simple PHP application using Exar
--------------------------------------------

[](#creating-a-simple-php-application-using-exar)

Create a package with a PHP class (e.g. `/lib/MyProject/Person.php`) that will become AOP features provided by Exar:

```
namespace MyProject;

/**
 * @Exar
 */
class Person {
	private $firstName;
	private $lastName;

	public function __construct($firstName, $lastName) {
		$this->firstName = $firstName;
		$this->lastName = $lastName;
	}

	/**
	 * @Track
	 */
	public function setFirstName($firstName) {
		$this->firstName = $firstName;
	}

	public function getFirstName() {
		return $this->firstName;
	}

	public function getLastName() {
		return $this->lastName;
	}
}

```

Create `index.php` file in the project root which will be the main file of your application:

```
/** load Composer dependencies */
require_once 'vendor/autoload.php';

/** add your class directory (where MyProject/Person.php is) to the include path */
set_include_path(dirname(__FILE__) . '/lib/' . PATH_SEPARATOR . get_include_path());

/** register namespaces that will be loaded by Exar (the namespace of Person.php) */
Exar\Autoloader::register(dirname(__FILE__) . '/_cache', array('MyProject'));

$person = new MyProject\Person('John', 'Smith');
echo 'first name = '.$person->getFirstName() . PHP_EOL;
echo 'last name = '.$person->getLastName() . PHP_EOL;

$person->setFirstName('Jim');
echo 'first name = '.$person->getFirstName() . PHP_EOL;
echo 'last name = '.$person->getLastName() . PHP_EOL;

```

Now run `index.php` and see the console output:

```
first name = John
last name = Smith
Before invocation: MyProject\Person->setFirstName (03.07.2014 11:45:48)
After returning: MyProject\Person->setFirstName (03.07.2014 11:45:48)
After invocation: MyProject\Person->setFirstName (03.07.2014 11:45:48)
first name = Jim
last name = Smith

```

What happened?

You created a `Person` object and printed the first and the last name. After that, you set the first name again. Since the method `setFirstName` is annotated with `@Track`, Exar intercepts the method execution and invokes the correspondent interceptor code. In this case, `@Track` just echoes the class and the name of the intercepted method, with the current timestamp. This example shows how Exar works: It adds functionality to your PHP classes on the basis of annotations within docblocks.

Stay tuned for more docs and examples!

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

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

4144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b56e704059c64ce2560a7df7e1ae04895d884775f5f70be3b7622bf572fe7a1f?d=identicon)[viktorwidiker](/maintainers/viktorwidiker)

---

Top Contributors

[![viktorwidiker](https://avatars.githubusercontent.com/u/5026101?v=4)](https://github.com/viktorwidiker "viktorwidiker (36 commits)")[![jg-development](https://avatars.githubusercontent.com/u/6112739?v=4)](https://github.com/jg-development "jg-development (1 commits)")

---

Tags

phpaop

### Embed Badge

![Health badge](/badges/techdev-solutions-exar/health.svg)

```
[![Health](https://phpackages.com/badges/techdev-solutions-exar/health.svg)](https://phpackages.com/packages/techdev-solutions-exar)
```

###  Alternatives

[goaop/framework

Framework for aspect-oriented programming in PHP.

1.7k4.0M33](/packages/goaop-framework)[pestphp/pest-plugin-drift

The Pest Drift Plugin

734.0M74](/packages/pestphp-pest-plugin-drift)[pestphp/pest-plugin-mutate

Mutates your code to find untested cases

4026.6M17](/packages/pestphp-pest-plugin-mutate)[luoxiaojun/sw-fw-less

Swoole Http Server without framework

165.3k](/packages/luoxiaojun-sw-fw-less)

PHPackages © 2026

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