diff --git a/app/Console/Commands/FetchLatestReleaseNumbers.php b/app/Console/Commands/FetchLatestReleaseNumbers.php index 8bc5301..d9b8b69 100644 --- a/app/Console/Commands/FetchLatestReleaseNumbers.php +++ b/app/Console/Commands/FetchLatestReleaseNumbers.php @@ -6,6 +6,7 @@ use Carbon\Carbon; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; +use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; use PHLAK\SemVer\Version; @@ -83,18 +84,20 @@ public function handle(): int { Log::info('Syncing Laravel Versions'); + $manualData = $this->getManualData(); + $this->fetchVersionsFromGitHub() - ->each(function ($item) { + ->each(function ($item) use ($manualData) { $semver = new Version($item['name']); - $firstReleaseSemver = $semver->major > 5 ? $semver->major . '.0.0' : $semver->major . '.' . $semver->minor . '.0'; - $firstRelease = LaravelVersion::where('first_release', $firstReleaseSemver)->first(); + $manualMajor = $manualData[$semver->major > 5 ? $semver->major : $semver->major . '.' . $semver->minor]; $versionMeta = [ 'changelog' => $item['changelog'], 'order' => LaravelVersion::calculateOrder($semver->major, $semver->minor, $semver->patch), 'released_at' => Carbon::parse($item['released_at'])->format('Y-m-d'), - 'ends_bugfixes_at' => $firstRelease?->ends_bugfixes_at, - 'ends_securityfixes_at' => $firstRelease?->ends_securityfixes_at, + 'ends_bugfixes_at' => $manualMajor->ends_bugfixes_at, + 'ends_securityfixes_at' => $manualMajor->ends_securityfixes_at, + 'supported_php' => $manualMajor->supported_php, ]; $version = LaravelVersion::withoutGlobalScope('first') @@ -192,4 +195,13 @@ private function fetchVersionsFromGitHub() ); }); } + + private function getManualData() + { + $import = json_decode(File::get(base_path('manual-version-info.json'))); + + return collect($import)->mapWithKeys(function ($item) { + return [$item->release => $item]; + }); + } } diff --git a/app/Http/Resources/LaravelVersionResource.php b/app/Http/Resources/LaravelVersionResource.php index 2e8acf1..7290e7e 100644 --- a/app/Http/Resources/LaravelVersionResource.php +++ b/app/Http/Resources/LaravelVersionResource.php @@ -21,6 +21,7 @@ public function toArray($request): array 'released_at' => $this->released_at, 'ends_bugfixes_at' => $this->ends_bugfixes_at, 'ends_securityfixes_at' => $this->ends_securityfixes_at, + 'supported_php' => explode(', ', $this->supported_php), 'status' => $this->status, $this->mergeWhen($this->specificVersionProvided($request), [ 'specific_version' => [ diff --git a/database/migrations/2023_08_25_202719_add_supported_php_to_laravel_versions_table.php b/database/migrations/2023_08_25_202719_add_supported_php_to_laravel_versions_table.php new file mode 100644 index 0000000..e69b179 --- /dev/null +++ b/database/migrations/2023_08_25_202719_add_supported_php_to_laravel_versions_table.php @@ -0,0 +1,22 @@ +string('supported_php')->nullable(); + }); + } + + public function down(): void + { + Schema::table('laravel_versions', function (Blueprint $table) { + $table->dropColumn('supported_php'); + }); + } +}; diff --git a/manual-version-info.json b/manual-version-info.json new file mode 100644 index 0000000..1606300 --- /dev/null +++ b/manual-version-info.json @@ -0,0 +1,134 @@ +[ + { + "release": "10", + "ends_bugfixes_at": "2024-08-07", + "ends_securityfixes_at": "2025-02-07", + "supported_php": "8.1, 8.2, (8.3)" + }, + { + "release": "9", + "ends_bugfixes_at": "2023-08-08", + "ends_securityfixes_at": "2024-02-08", + "supported_php": "8.0, 8.1, 8.2, (8.3)" + }, + { + "release": "8", + "ends_bugfixes_at": "2022-07-26", + "ends_securityfixes_at": "2023-01-24", + "supported_php": "7.3, 7.4, 8.0" + }, + { + "release": "7", + "ends_bugfixes_at": "2020-10-06", + "ends_securityfixes_at": "2021-03-03", + "supported_php": "7.2, 7.3, 7.4, 8.0" + }, + { + "release": "6", + "ends_bugfixes_at": "2021-09-07", + "ends_securityfixes_at": "2022-09-06", + "supported_php": "7.2, 7.3, 7.4" + }, + { + "release": "5.8", + "ends_bugfixes_at": "2019-08-26", + "ends_securityfixes_at": "2020-02-26", + "supported_php": "7.1, 7.2, 7.3, 7.4?" + }, + { + "release": "5.7", + "ends_bugfixes_at": "2019-03-04", + "ends_securityfixes_at": "2019-09-04", + "supported_php": "7.1, 7.2, 7.3, 7.4?" + }, + { + "release": "5.6", + "ends_bugfixes_at": "2018-08-07", + "ends_securityfixes_at": "2019-02-07", + "supported_php": "7.1, 7.2, 7.3, 7.4?" + }, + { + "release": "5.5", + "ends_bugfixes_at": "2019-08-30", + "ends_securityfixes_at": "2020-08-30", + "supported_php": "7.0, 7.1, 7.2" + }, + { + "release": "5.4", + "ends_bugfixes_at": "2017-07-24", + "ends_securityfixes_at": "2018-01-24", + "supported_php": "5.6, 7.0, 7.1" + }, + { + "release": "5.3", + "ends_bugfixes_at": "2017-02-23", + "ends_securityfixes_at": "2017-08-23", + "supported_php": "5.6, 7.0" + }, + { + "release": "5.2", + "ends_bugfixes_at": "2016-06-21", + "ends_securityfixes_at": "2016-12-12", + "supported_php": "5.5, 5.6, 7.0" + }, + { + "release": "5.1", + "ends_bugfixes_at": "2017-06-09", + "ends_securityfixes_at": "2018-06-09", + "supported_php": "5.5, 5.6, 7.0?" + }, + { + "release": "5.0", + "ends_bugfixes_at": "2015-08-04", + "ends_securityfixes_at": "2016-02-04", + "supported_php": "5.4, 5.5, 5.6" + }, + { + "release": "4.2", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "4.1", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "4.0", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "3.2", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "3.1", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "3.0", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "2.0", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + }, + { + "release": "1.0", + "ends_bugfixes_at": null, + "ends_securityfixes_at": null, + "supported_php": "" + } +] diff --git a/resources/views/partials/tables/current_table.blade.php b/resources/views/partials/tables/current_table.blade.php index 7ebd617..5e3c3d6 100644 --- a/resources/views/partials/tables/current_table.blade.php +++ b/resources/views/partials/tables/current_table.blade.php @@ -6,10 +6,10 @@ - - + @@ -34,7 +37,7 @@ }} +
+ {{ __('Version') }} + {{ __('Release date') }} @@ -18,6 +18,9 @@ {{ __('Security Fixes Until') }} + {{ __('PHP Versions') }} + {{ __('Status') }} - {{ $version->released_at->gt(now()) + {{ $version->released_at->gt(now()) ? 'Q' . $version->released_at->quarter . ' ' . $version->released_at->year . ' (' . __('estimated') . ')' : $version->released_at->translatedFormat(__('DateLongFormat')) }} @@ -53,6 +56,9 @@ : $version->ends_securityfixes_at->translatedFormat(__('DateLongFormat')) }} @endif + {{ $version->supported_php }} +
{{ $statusTextMap[$version->status] }} diff --git a/resources/views/partials/tables/eol_table.blade.php b/resources/views/partials/tables/eol_table.blade.php index 4c12a2d..3a0788f 100644 --- a/resources/views/partials/tables/eol_table.blade.php +++ b/resources/views/partials/tables/eol_table.blade.php @@ -12,18 +12,21 @@ - - - - + @@ -32,41 +35,44 @@ @foreach ($inactiveVersions as $version) - - + - - + - + - - + + + + @endforeach
+ {{ __('Version') }} + {{ __('Release date') }} + {{ __('Bug Fixes Until') }} + {{ __('Security Fixes Until') }} + {{ __('PHP Versions') }} + {{ __('Status') }}
- {{ $version->major }}{{ +
+ {{ $version->major }}{{ $version->major < 6 ? '.' . $version->minor : '' }} - - {{ + + + {{ $version->released_at->translatedFormat(__('DateLongFormat')) }} {{ $version->released_at->gt(now()) ? '(' . __('estimated') . ')' : '' }} - - {{ + + {{ $version->ends_bugfixes_at ? $version->ends_bugfixes_at->translatedFormat(__('DateLongFormat')) : '' }} - - {{ + + {{ $version->ends_securityfixes_at ? $version->ends_securityfixes_at->translatedFormat(__('DateLongFormat')) : '' }} - -
- {{ $statusTextMap[$version->status] }} -
-
+ {{ $version->supported_php }} + +
+ {{ $statusTextMap[$version->status] }} +
+
diff --git a/resources/views/partials/tables/show_table.blade.php b/resources/views/partials/tables/show_table.blade.php index fe862f4..8afa33a 100644 --- a/resources/views/partials/tables/show_table.blade.php +++ b/resources/views/partials/tables/show_table.blade.php @@ -2,18 +2,21 @@ - - - - + @@ -77,6 +80,9 @@ : '' }} +
+ {{ __('Major Version') }} + {{ __('Release date') }} + {{ __('Bug Fixes Until') }} + {{ __('Security Fixes Until') }} + {{ __('PHP Versions') }} + {{ __('Status') }} + {{ $version->supported_php }} +
{{ $statusTextMap[$version->status] }} diff --git a/resources/views/versions/index.blade.php b/resources/views/versions/index.blade.php index 28080dd..7773e83 100644 --- a/resources/views/versions/index.blade.php +++ b/resources/views/versions/index.blade.php @@ -27,7 +27,7 @@
{!! __('A list of currently supported PHP versions can be found here: :link', [ - 'link' => 'https://www.php.net/supported-versions.php' + 'link' => 'https://phpreleases.com/' ]); !!}
diff --git a/tests/Feature/ApiListVersionsTest.php b/tests/Feature/ApiListVersionsTest.php index 4751920..35ac658 100644 --- a/tests/Feature/ApiListVersionsTest.php +++ b/tests/Feature/ApiListVersionsTest.php @@ -83,6 +83,7 @@ private function getVersionsJsonResponse(Collection $versions): string $versions = $versions->map(fn ($version) => [ 'ends_bugfixes_at' => $version->ends_bugfixes_at, 'ends_securityfixes_at' => $version->ends_securityfixes_at, + 'supported_php' => explode(', ', $version->supported_php), 'global' => [ 'latest_version' => LaravelVersion::withoutGlobalScope('first')->latest('order')->first()->semver, ],