PHP code example of assegaiphp / attributes

1. Go to this page and download the library: Download assegaiphp/attributes 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/ */

    

assegaiphp / attributes example snippets




use Assegai\Attributes\Enumerations\Scope;
use Assegai\Attributes\Injectable;
use Assegai\Attributes\ScopeOptions;

#[Injectable(new ScopeOptions(scope: Scope::DEFAULT, durable: true))]
class HeroService
{
}



use Assegai\Attributes\Controller;

#[Controller(path: 'heroes')]
class HeroesController
{
}



use Assegai\Attributes\Component;

#[Component(
  selector: 'app-hero-card',
  templateUrl: './HeroCardComponent.twig',
  styleUrls: ['./HeroCardComponent.css'],
)]
class HeroCardComponent
{
}



use Assegai\Attributes\OnException;
use RuntimeException;

#[OnException(RuntimeException::class)]
class RuntimeExceptionHandler
{
}



use Assegai\Attributes\ParamAttribute;
use Attribute;

#[Attribute(Attribute::TARGET_PARAMETER)]
final class Param extends ParamAttribute
{
}