PHP code example of duncanmcclean / best-before

1. Go to this page and download the library: Download duncanmcclean/best-before library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

duncanmcclean / best-before example snippets


use DuncanMcClean\BestBefore\BestBefore;

#[BestBefore('2026-12-25', 'Only valid until Christmas.')]
class BackfillOrderTotals extends Command
{
    // ...
}

class OrderResource extends JsonResource
{
    #[BestBefore('2027-01-31', 'Keep `total` until the mobile app reads `grand_total`.')]
    private function legacyFields(): array
    {
        // ...
    }
}