PHP code example of antares / accessible-bundle

1. Go to this page and download the library: Download antares/accessible-bundle 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-bundle 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

composer 

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...

        new Antares\Bundle\AccessibleBundle\AntaresAccessibleBundle()
    );
}

# app/config/config.yml
framework:
  property_access:
    magic_call: true

# app/config/services.yml

parameters:
    antares_accessible.cache_driver.class: Doctrine\Common\Cache\ApcCache

services:
    antares_accessible.cache.driver:
        class: "%antares_accessible.cache_driver.class%"
    antares_accessible.annotations.cache_driver:
        class: "%antares_accessible.cache_driver.class%"

# app/config/services.yml

services:
    antares_accessible.annotations.reader:
        class: Doctrine\Common\Annotations\AnnotationReader

# app/config/services.yml

services:
    antares_accessible.constraints_validation.validator: '@validator'