Skip to content

yarcowang/fast_gster.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fast Getter and Setter

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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages