vasildakov/postcode-doctrine

UK Postcode Doctrine Type

1.0.4 2016-10-07 01:54 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:31:48 UTC


README

Doctrine UK Postcode Type

Build Status Coverage Status HHVM Status Scrutinizer Code Quality Latest Stable Version Total Downloads License

Installation

The preferred method of installation is via Packagist and Composer. Run the following command to install the package and add it as a requirement to your project's composer.json:

composer require vasildakov/postcode-doctrine

Configuration

To configure Doctrine to use vasildakov/postcode as a field type, you'll need to set up the following in your bootstrap:

\Doctrine\DBAL\Types\Type::addType('postcode', 'VasilDakov\Postcode\Doctrine\PostcodeType');

Then, in your models, you may annotate properties by setting the @Column type to postcode.

/**
 * @Entity
 * @Table(name="address")
 */
class Address
{
    /**
     * @var \VasilDakov\Postcode\Postcode
     * @Column(type="postcode")
     */
    protected $postcode;

    public function getPostcode()
    {
        return $this->postcode;
    }
}

Copyright and License

The vasildakov/postcode-doctrine library is copyright © Vasil Dakov and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information.