2017 © Pedro Peláez
 

library accessible

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

image

antares/accessible

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

  • Tuesday, September 27, 2016
  • by antares993
  • Repository
  • 3 Watchers
  • 14 Stars
  • 1,913 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 9 % Grown

The README.md

Accessible

SensioLabsInsight Build Status Code Coverage Scrutinizer Code Quality Dependency Status Latest Stable Version License, (*1)

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

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

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

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:, (*5)

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., (*6)

What this library can manage in your classes:, (*7)

  • 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!, (*8)

Documentation

Install

If you want to use this library in your Symfony project, take a look at AccessibleBundle., (*9)

You can add this library as a dependency using composer this way:, (*10)

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:, (*11)

$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., (*12)

Compatibility

This library is compatible with PHP 5.4+, PHP 7 and HHVM., (*13)

The Versions

27/09 2016

dev-master

9999999-dev https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

26/04 2016

v3.1

3.1.0.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

05/03 2016

v3.0

3.0.0.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

05/03 2016

v2.1.1

2.1.1.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

10/02 2016

v2.1

2.1.0.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

08/02 2016

v2.0.2

2.0.2.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

08/02 2016

v2.0.1

2.0.1.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

08/02 2016

v2.0

2.0.0.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

21/11 2015

v1.0.1

1.0.1.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo

16/11 2015

v1.0

1.0.0.0 https://github.com/antares993/Accessible

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Antarès Tupin

access class getter setter annotation set properties get popo pojo