Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Yearly Laravel Package

busayo/laravel-yearly

A lightweight Laravel package for working with yearly cycles and annual date logic. It offers helpers for year-based queries, annual date ranges, and recurring yearly events, making calendar-year data easier to handle in your models and application.

View on GitHub
Deep Wiki
Context7

Getting Started

The package is a single-purpose helper: it renders a copyright year (or year range) that stays current without you editing a footer every January. Treat it as a 20-line convenience, not infrastructure.

  1. Install (Laravel 5.x only — see Gotchas):
composer require busayo/laravel-yearly
  1. Register the provider manually. This package predates package auto-discovery (Laravel 5.5), so add it to config/app.php:
'providers' => [
    // ...
    Busayo\Yearly\YearlyServiceProvider::class,
],

If the README mentions a facade, add it to aliases in the same file.

  1. Publish any config if the package ships one, so you can set the "start year" of your copyright range:
php artisan vendor:publish --provider="Busayo\Yearly\YearlyServiceProvider"
  1. Look first at vendor/busayo/laravel-yearly/src/ — the whole package is one provider plus one helper/directive class. Read it before wiring it in; you need to know the exact call signature (helper name, Blade directive, or facade method) since the 2015 README may not match modern expectations.

  2. First use case: your layout footer.

<footer>
    &copy; {{ yearly() }} Acme Inc. All rights reserved.
</footer>

If your site launched in 2012, you want © 2012–2026, so set the start year in the published config rather than hardcoding it in the template.

Implementation Patterns

Inline helper in a single layout. Keep it in resources/views/layouts/app.blade.php only. There is no reason to sprinkle it across partials.

View composer for anything non-trivial. If you need formatting variants (short year, full range, per-entity copyright holders), don't bend the package — wrap it:

// app/Providers/AppServiceProvider.php
View::composer('layouts.app', function ($view) {
    $view->with('copyright', sprintf(
        '© %s–%s Acme Inc.',
        config('site.copyright_start', 2012),
        now()->year
    ));
});

Testing. Freeze time so your footer assertion is stable:

use Illuminate\Support\Carbon;

public function test_footer_shows_current_year()
{
    Carbon::setTestNow(Carbon::create(2026, 1, 1, 0, 0, 1));
    $this->get('/')->assertSee('2026');
    Carbon::setTestNow();
}

If the package caches the rendered year at boot, this test will fail on a long-running process — that's your signal to swap to now()->year.

Integration tip — mail and PDF templates. Any Blade-rendered footer (invoices, terms pages, PDF exports) is a legitimate target. For queued mail, remember the view renders at send time, not at dispatch time; if a job sits in the queue across New Year you'll get the old year. Acceptable for a copyright line.

Migration path. If you already require Laravel 5.5+, the package has no advantage over a Blade component or {{ now()->year }}. Migrate by replacing the directive with now()->year in the layout, deleting the provider line, and running composer remove busayo/laravel-yearly.

Gotchas and Tips

  • Abandoned since 2015. No Laravel 6+ support, no PHP 7.4/8.x guarantees, no security fixes. On a modern app the composer require will likely fail on platform constraints; you'd need --ignore-platform-reqs, which is a bad trade for a footer string.
  • No auto-discovery. Forgetting the config/app.php provider entry is the number one "class not found" / "directive not defined" cause. If you see Method [yearly] does not exist, check the provider first.
  • Timezone mismatch. The package almost certainly uses Carbon::now(), which respects config/app.php's timezone. A copyright year in UTC vs a NZ app timezone can disagree for ~13 hours around New Year. Pick one and be consistent; for legal footers, UTC is the safer default.
  • Range vs single year. © 2026 and © 2012–2026 are different claims. The start year should come from config or a DB-backed setting, not a value buried in the vendor package. Never let the package decide your founding year.
  • Long-running workers. Octane/queue daemons and php artisan serve in a dev loop can hold a booted value across midnight on Dec 31. Cosmetic, but it will confuse you in a late-night deploy. now()->year evaluated at render time is immune.
  • Full-page caching. If you cache rendered HTML for hours or days, the year is as stale as the cache. Either purge at New Year or leave that one template uncached.
  • Debugging. php artisan tinker then call the helper directly to confirm registration before blaming the template. Clear config:cache after publishing config — the classic reason a start-year change "did nothing".
  • Extension points. There are essentially none. If you need multiple copyright holders, per-locale formatting, or a "last updated" date, write a small CopyrightPresenter class or a Blade component. That is 15 lines and will outlive this package.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package