acti/am_i_up_to_date_sf
Symfony-focused helper to check whether your project’s dependencies are up to date. Adds a simple command/utility for scanning installed packages and reporting available updates, making it easier to spot outdated components during development or CI.
Installation Add the package via Composer:
composer require acti/am_i_up_to_date_sf
Publish the config file (if needed):
php artisan vendor:publish --provider="Acti\AmIUpToDateSF\ServiceProvider"
Basic Usage
Inject the AmIUpToDateSF facade or service into a controller/console command:
use Acti\AmIUpToDateSF\Facades\AmIUpToDateSF;
public function checkUpdates()
{
$result = AmIUpToDateSF::check();
return response()->json($result);
}
First Use Case Verify if your Laravel app meets the minimum requirements (PHP version, Laravel version, dependencies) via a health check endpoint:
public function healthCheck()
{
$status = AmIUpToDateSF::check();
return $status['isUpToDate']
? response()->json(['status' => 'healthy'])
: response()->json(['status' => 'outdated', 'details' => $status], 500);
}
Pre-Deployment Checks Integrate into CI/CD pipelines (GitHub Actions, GitLab CI) to block deployments if requirements aren’t met:
# Example GitHub Actions step
- name: Check Laravel/Composer Updates
run: |
php artisan vendor:publish --provider="Acti\AmIUpToDateSF\ServiceProvider"
php artisan check:updates
Admin Dashboard Integration Display update status in an admin panel:
// In a Blade view
@php
$updateStatus = AmIUpToDateSF::check();
@endphp
<div class="alert alert-{{ $updateStatus['isUpToDate'] ? 'success' : 'warning' }}">
System Status: {{ $updateStatus['isUpToDate'] ? 'Up to Date' : 'Outdated' }}
</div>
Scheduled Notifications Use Laravel’s scheduler to email/Slack admins when updates are available:
// In App\Console\Commands\CheckUpdatesCommand.php
public function handle()
{
$status = AmIUpToDateSF::check();
if (!$status['isUpToDate']) {
Notification::route('mail', ['admin@example.com'])
->notify(new UpdateAvailable($status));
}
}
Schedule the command:
* * * * * php artisan check:updates
Custom Requirements Extend the checker for project-specific rules (e.g., database schema):
// In config/am_i_up_to_date_sf.php
'custom_checks' => [
function () {
return DB::table('migrations')->exists();
},
'Your database must have migrations applied.',
],
False Positives
composer.json), not necessarily runtime (e.g., PHP CLI vs. FPM). Verify with:
$phpVersion = PHP_VERSION;
$requiredVersion = config('am_i_up_to_date_sf.php_requirements');
php -r "echo PHP_VERSION;" in CI/CD to match runtime.Overridden Config
strict_mode in config/am_i_up_to_date_sf.php:
'strict_mode' => false, // Allow warnings instead of failures
Performance Impact
AmIUpToDateSF::check() in a loop (e.g., API endpoint) may slow responses.$status = Cache::remember('update_check', now()->addHours(1), function () {
return AmIUpToDateSF::check();
});
Dependency Conflicts
laravel-updater).'exclude_packages' => ['laravel-updater'],
Detailed Output: Enable verbose mode in config:
'verbose' => true,
This logs all checks (PHP, Laravel, Composer) to storage/logs/laravel.log.
Custom Check Errors: If a lambda check fails, inspect the error message:
$status = AmIUpToDateSF::check();
if (isset($status['errors']['custom'])) {
Log::error('Custom check failed:', $status['errors']['custom']);
}
Add New Check Types
Extend the CheckInterface to support custom logic (e.g., AWS SDK version):
namespace App\Checks;
use Acti\AmIUpToDateSF\Contracts\CheckInterface;
class AwsSdkCheck implements CheckInterface
{
public function check(): array
{
$version = \Aws\getSdk()->getVersion();
return [
'isValid' => version_compare($version, '3.0', '>='),
'message' => 'AWS SDK must be >= 3.0',
];
}
}
Register in config/am_i_up_to_date_sf.php:
'custom_checks' => [
App\Checks\AwsSdkCheck::class,
],
Modify Response Format
Override the AmIUpToDateSF facade binding to transform output:
// In AppServiceProvider@boot()
$this->app->bind(\Acti\AmIUpToDateSF\Facades\AmIUpToDateSF::class, function ($app) {
return new class extends \Acti\AmIUpToDateSF\Facades\AmIUpToDateSF {
public function check()
{
$result = parent::check();
return collect($result['errors'])->keyBy('type')->toArray();
}
};
});
Silent Mode Suppress output for CLI scripts:
$status = AmIUpToDateSF::check(['silent' => true]);
How can I help you explore Laravel packages today?