Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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