Require this package with composer.
composer require gjpbw/date-ago
Laravel <5.5
After updating composer, add the service provider to the providers
array in config/app.php
Gjpbw\DateAgo\DateAgoServiceProvider::class,
Laravel >=5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
php artisan vendor:publish --provider="Gjpbw\DateAgo\DateAgoServiceProvider"
dateAgo($date)