Skip to content

Commit 05c9130

Browse files
authored
[laravel] fix build locally + attempt fix CI build (#1271)
1 parent 8416e08 commit 05c9130

File tree

4 files changed

+809
-558
lines changed

4 files changed

+809
-558
lines changed

.github/workflows/auto-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ jobs:
6363
distribution: 'temurin'
6464
java-version: '24'
6565

66+
# IMPORTANT: PHP version must match laravel/composer.json (require.php and config.platform.php)
67+
# and laravel/build.sh (REQUIRED_PHP_MAJOR_MINOR). Update all three when changing versions.
6668
- name: Set up PHP
6769
uses: shivammathur/setup-php@v2
6870
with:

laravel/build.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,36 @@
22

33
set -e
44

5+
# =============================================================================
6+
# PHP Version Check
7+
# This project requires PHP 8.3.x. Fail fast if a different version is used.
8+
# =============================================================================
9+
REQUIRED_PHP_MAJOR_MINOR="8.3"
10+
CURRENT_PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
511

6-
composer install
12+
if [[ "$CURRENT_PHP_VERSION" != "$REQUIRED_PHP_MAJOR_MINOR" ]]; then
13+
echo "ERROR: PHP version mismatch!"
14+
echo " Required: PHP ${REQUIRED_PHP_MAJOR_MINOR}.x"
15+
echo " Current: PHP $(php -r 'echo PHP_VERSION;')"
16+
echo ""
17+
echo "Please install PHP ${REQUIRED_PHP_MAJOR_MINOR}.x or update the version requirements in:"
18+
echo " - laravel/composer.json (require.php and config.platform.php)"
19+
echo " - .github/workflows/auto-deploy.yml (setup-php php-version)"
20+
exit 1
21+
fi
22+
23+
echo "PHP version check passed: $(php -r 'echo PHP_VERSION;')"
24+
25+
# =============================================================================
26+
# Install dependencies
27+
# Using --no-scripts to work around Laravel 12 bug where package:discover
28+
# fails with "Call to a member function make() on null" during composer install.
29+
# See: https://github.com/laravel/framework/issues/56098
30+
# =============================================================================
31+
composer install --no-scripts
32+
33+
# Run composer scripts manually (except package:discover which has the bug)
34+
composer dump-autoload --optimize
735

836
php artisan optimize:clear
937
php artisan optimize

laravel/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"keywords": ["laravel", "framework"],
77
"license": "MIT",
88
"require": {
9-
"php": "^8.2",
9+
"php": "~8.3.0",
1010
"laravel/framework": "^12.0",
1111
"laravel/tinker": "^2.10.1",
1212
"sentry/sentry-laravel": "^4.15"
@@ -69,6 +69,9 @@
6969
"allow-plugins": {
7070
"pestphp/pest-plugin": true,
7171
"php-http/discovery": true
72+
},
73+
"platform": {
74+
"php": "8.3.30"
7275
}
7376
},
7477
"minimum-stability": "stable",

0 commit comments

Comments
 (0)