PHPackages                             antares/accessible - 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. antares/accessible

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

antares/accessible
==================

PHP library that allows you to define your class' getters, setters and constructor with docblock annotations.

v3.1(10y ago)123.9k21MITPHPPHP &gt;=5.4.0

Since Nov 16Pushed 6y ago3 watchersCompare

[ Source](https://github.com/antares993/Accessible)[ Packagist](https://packagist.org/packages/antares/accessible)[ Docs](https://github.com/antares993/Accessible)[ RSS](/packages/antares-accessible/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (6)Versions (10)Used By (1)

Accessible
==========

[](#accessible)

[![SensioLabsInsight](https://camo.githubusercontent.com/5b47e721cac6614fcbed4d1532da5586d8d2d6da9aff8bc66a2ed19527f991cb/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f64303739316239382d636439362d343533612d626638392d3339646463633637326339382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/d0791b98-cd96-453a-bf89-39ddcc672c98)[![Build Status](https://camo.githubusercontent.com/c0d76096e2641ac1db1f6e276ac5f5102a0bb27da31d0353b502953a0f2789e2/68747470733a2f2f7472617669732d63692e6f72672f616e7461726573747570696e2f41636365737369626c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/antarestupin/Accessible)[![Code Coverage](https://camo.githubusercontent.com/a4994b384793e37d7095d68989503221c1f46e347d9defb3d01c02d5afa78ade/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e74617265733939332f41636365737369626c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/antares993/Accessible/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/347bb2281544a425772a73c11b348a0304fd0bf566d1194cb6d804e90e20a708/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616e74617265733939332f41636365737369626c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/antares993/Accessible/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/1a8647dac285a0ff39dc9852593b21b6e6b47a66ec95810a2e0d2ad639d69297/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537323238343931626133376365303034333039656362332f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/57228491ba37ce004309ecb3)[![Latest Stable Version](https://camo.githubusercontent.com/477c41f1baa2a3bb6646cfbd8d61b3fec65f42b8b6db999b32b769d067025ea6/68747470733a2f2f706f7365722e707567782e6f72672f616e74617265732f61636365737369626c652f762f737461626c65)](https://packagist.org/packages/antares/accessible)[![License](https://camo.githubusercontent.com/bd74caee50a901f82d02bf89ed20f9ba0effd6fe56287e74f6ed73ad3af667a4/68747470733a2f2f706f7365722e707567782e6f72672f616e74617265732f61636365737369626c652f6c6963656e7365)](https://packagist.org/packages/antares/accessible)

Accessible is a PHP library that allows you to define your class behavior in an elegant and powerful way using docblock annotations.

This way, you can define your class' getters, setters and constructor, and automate collections and association management.

Here is a (very) basic example with getters and setters:

```
class Customer
{
  use AutomatedBehaviorTrait;

  /**
   * @Access({Access::GET, Access::SET})
   * @Assert\Email
   */
  private $email;
}

$bob = new Customer();

$bob->setEmail('bob@example.com');
$bob->getEmail(); // bob@example.com
$bob->setEmail('not an email address'); // throws an InvalidArgumentException
```

Another example using collections related annotations:

```
class Server
{
  use AutomatedBehaviorTrait;

  /**
   * @Access({Access::GET})
   * @InitializeObject(ArrayCollection::class)
   * @ListBehavior
   */
  private $processes;
}

$server = new Server();

$server->getProcesses(); // Instance of ArrayCollection
$process = new Process();
$server->addProcess($process);
$server->removeProcess($process);
```

More complex examples are available in the doc.

What this library can manage in your classes:

- Getters and setters
- Validation on setters parameters using Symfony's Assertion annotations
- Constructor and properties initialization
- Collections
- Associations between classes

**Suggestions and contributions are welcome!**

Documentation
-------------

[](#documentation)

- [How to define getters and setters](https://github.com/antares993/Accessible/tree/master/doc/accessible.md)
- [How to define the class constructor and the properties initialization](https://github.com/antares993/Accessible/tree/master/doc/auto-construct.md)
- [How to enable / disable the constraints validation](https://github.com/antares993/Accessible/tree/master/doc/constraints-validation.md)
- [How to manage collections](https://github.com/antares993/Accessible/tree/master/doc/collections.md)
- [How to manage associations](https://github.com/antares993/Accessible/tree/master/doc/associations.md)
- [How to modify the default configuration](https://github.com/antares993/Accessible/tree/master/doc/configuration.md)
- [Compatibility issues (and how to solve them)](https://github.com/antares993/Accessible/tree/master/doc/compatibility.md)

Install
-------

[](#install)

If you want to use this library in your Symfony project, take a look at [AccessibleBundle](https://github.com/antares993/AccessibleBundle).

You can add this library as a dependency using composer this way:

```
composer require antares/accessible

```

This library uses the Doctrine annotations library, so if it is not already done you must register the Composer loader in the annotation registry:

```
$loader = require __DIR__ . '/vendor/autoload.php';
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
```

You may want to change the default configuration, to do this see the [Configuration dedicated page](https://github.com/antares993/Accessible/tree/master/doc/configuration.md).

Compatibility
-------------

[](#compatibility)

This library is compatible with PHP 5.4+, PHP 7 and HHVM.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 99.4% 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 ~20 days

Total

9

Last Release

3672d ago

Major Versions

v1.0.1 → v2.02016-02-08

v2.1.1 → v3.02016-03-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/55869ec69e18049202985f8d3581e805059bb843cef71f5a8eed3d1d7592ab0e?d=identicon)[antares993](/maintainers/antares993)

---

Top Contributors

[![antarestupin](https://avatars.githubusercontent.com/u/7022740?v=4)](https://github.com/antarestupin "antarestupin (167 commits)")[![delormejonathan](https://avatars.githubusercontent.com/u/5949870?v=4)](https://github.com/delormejonathan "delormejonathan (1 commits)")

---

Tags

classsetaccesspropertiesgetgettersetterannotationpopopojo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/antares-accessible/health.svg)

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

###  Alternatives

[antares/accessible-bundle

A bundle to easily use Accessible in Symfony projects.

153.8k](/packages/antares-accessible-bundle)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[gomachan46/state-machine

simple state machine with annotations for PHP, inspired by AASM known as a Ruby state machine.

1893.9k](/packages/gomachan46-state-machine)

PHPackages © 2026

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