PHP code example of antares / accessible

1. Go to this page and download the library: Download antares/accessible library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

antares / accessible example snippets


class Customer
{
  use AutomatedBehaviorTrait;

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


$bob = new Customer();

$bob->setEmail('[email protected]');
$bob->getEmail(); // [email protected]
$bob->setEmail('not an email address'); // throws an InvalidArgumentException

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);

$loader = Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));