yarco/fast_gster

A simple way to add getter/setter feature by using attribute grammar

v1.0.1 2024-02-29 08:23 UTC

This package is auto-updated.

Last update: 2024-03-29 08:29:25 UTC


README

Install

composer require yarco/fast-gster

Usage

<?php

use \Yarco\FastGster\{Base, Get, Set};

class Example03
{
    use Base;

    // comparing to define "getName, setName" by hand
    #[Get, Set]
    private string $name;

    // can also add a guard, will throw an exception if the guard is not met
    #[Get, Set('age > 0 and age < 120')]
    private int $age;
}

see more in tests/.

Expression Language

Read more expression language from Symfony