busayo/laravel-yearly

Provides helper function to get the current year and a range of years

1.1.0 2015-10-24 23:32 UTC

This package is auto-updated.

Last update: 2024-12-07 18:45:49 UTC


README

Latest Stable Version License Build Status Quality Score Total Downloads

Laravel 5 Package to help keep your copyright year up-to-date. Simple but insanely useful.

Install

PHP 5.5+ or HHVM 3.3+, and Composer are required.

Via Composer

$ composer require busayo/laravel-yearly

Another alternative is to simply add the following line to the require block of your composer.json file.

"unicodeveloper/laravel-yearly": "1.1.*"

Then run composer install or composer update to download it and have the autoloader updated.

Add this to your providers array in config/app.php

// Laravel 5: config/app.php

'providers' => [
    ...
    'Unicodeveloper\Yearly\YearlyServiceProvider',
    ...
];

This package also comes with a facade

// Laravel 5: config/app.php

'aliases' => [
    ...
    'Yearly' => 'Unicodeveloper\Yearly\YearlyFacade',
    ...
]

Usage

Use it in your views, preferably in your footer section like this:

{{ current_year() }}  // returns 2015 ( This is the current year presently )

{{ year_range(2002) }} // returns 2002 - 2015

For those that love Facades immensely, I have provided the cake for you 😄 like so:

{{ Yearly::current_year() }}  // returns 2015 ( This is the current year presently )

{{ Yearly::year_range(2002) }} // returns 2002 - 2015

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

You can run the tests with:

vendor/bin/phpunit run

Alternatively, you can run the tests like so:

composer test

Inspiration

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.