Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diogocavilha/piano-accessor
This package allows us to create getters and setters just by using a few annotations.
https://github.com/diogocavilha/piano-accessor
annotations composer composer-library composer-package composer-packages php-library piano-accessor setters
Last synced: 30 days ago
JSON representation
This package allows us to create getters and setters just by using a few annotations.
- Host: GitHub
- URL: https://github.com/diogocavilha/piano-accessor
- Owner: diogocavilha
- Created: 2016-05-28T07:52:53.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-27T23:59:07.000Z (over 5 years ago)
- Last Synced: 2024-11-15T21:47:00.420Z (about 2 months ago)
- Topics: annotations, composer, composer-library, composer-package, composer-packages, php-library, piano-accessor, setters
- Language: PHP
- Homepage:
- Size: 24.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/diogocavilha/piano-accessor.svg?branch=master)](https://travis-ci.org/diogocavilha/piano-accessor)
[![Latest Stable Version](https://img.shields.io/packagist/v/piano/accessor.svg?style=flat-square)](https://packagist.org/packages/piano/accessor)# Piano Accessor
This package allows us to create getters and setters just by using a few annotations.
# Installing
```sh
composer require piano/accessor
```# Usage example
See the example:
This `User` class:
```php
name = $name;
}public function setAge($age)
{
$this->age = (int) $age;
}public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
}public function getName()
{
return $this->name;
}public function getAge()
{
return (int) $this->age;
}public function getCreatedAt()
{
return $this->createdAt;
}
}
```Is the same as this `User` class:
```php