Skip to content

Conversation

@egyjs
Copy link
Owner

@egyjs egyjs commented Jun 23, 2025

📋 Description

This PR adds comprehensive Laravel installation testing capabilities to ensure the egyjs/progressive-json-php package works correctly across multiple Laravel versions and PHP versions.

What does this PR do?

  • Adds automated Laravel installation testing via GitHub Actions workflow
  • Creates comprehensive test scripts for local Laravel compatibility testing
  • Implements support matrix for PHP 8.1+ and Laravel 9.x through 12.x
  • Adds detailed documentation for Laravel installation testing procedures
  • Updates package requirements to PHP 8.1+ (dropping PHP 8.0 support)
  • Enhances README with Laravel installation test information

Why is this change needed?

  • Ensures package compatibility across the Laravel ecosystem (v9-v12)
  • Provides confidence for Laravel developers using this package
  • Automates testing to catch breaking changes early
  • Establishes clear support matrix for PHP/Laravel combinations
  • Improves package reliability and adoption in Laravel projects

🔗 Related Issues

  • Related to Laravel framework compatibility requirements
  • Addresses need for comprehensive integration testing

🧪 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation only changes
  • 🔧 Code refactoring (no functional changes)
  • ⚡ Performance improvements
  • 🧪 Test improvements
  • 🔨 Build/CI changes

🧪 Testing

New Tests Added

  • Unit tests for new functionality
  • Integration tests
  • Edge case testing
  • Performance tests
  • No tests needed (documentation/minor changes)

Test Coverage

  • All new code is covered by tests
  • Existing tests still pass
  • Manual testing completed

How to Test

  1. Run the Laravel installation test workflow: .github/workflows/laravel-installation-test.yml
  2. Execute local test script: ./scripts/test-laravel-installation.sh
  3. Verify package installation in a fresh Laravel app
  4. Test basic functionality with Laravel context

Test Code Example:

<?php
// Test Laravel integration
use Egyjs\ProgressiveJson\ProgressiveJsonStreamer;

// In a Laravel controller
$streamer = new ProgressiveJsonStreamer();
$streamer->data([
    'user' => '{$}',
    'posts' => '{$}'
]);

$streamer->addPlaceholders([
    'user' => fn() => auth()->user(),
    'posts' => fn() => Post::latest()->take(10)->get()
]);

return $streamer->asResponse(); // Returns Symfony StreamedResponse

📖 Documentation

  • README updated with new features/changes
  • Code comments added/updated
  • PHPDoc blocks updated
  • Examples added/updated
  • CHANGELOG.md updated (for significant changes)
  • No documentation changes needed

⚡ Performance Impact

  • No performance impact
  • Performance improved
  • Performance may be affected (explain below)
  • Performance benchmarks included

Performance Notes:
The Laravel installation tests include performance monitoring to ensure the package maintains acceptable performance across different Laravel versions.

💥 Breaking Changes

  • No breaking changes
  • Breaking changes (describe below)

Migration Guide:

  • PHP 8.0 Support Dropped: Users on PHP 8.0 must upgrade to PHP 8.1+
  • Package Version: Updated to v1.1.0 with enhanced Symfony HttpFoundation compatibility
  • Composer Requirements: Now requires symfony/http-foundation: ^5.4 || ^6.0 || ^7.0

✅ Checklist

Code Quality

  • My code follows the project's coding standards (PSR-12)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have added type declarations where appropriate

Testing & Documentation

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly
  • I have added examples for new features

Git & Process

  • My commits are atomic and have descriptive messages
  • I have rebased my branch on the latest main branch
  • I have resolved any merge conflicts
  • I have linked relevant issues in the description

Community Guidelines

📝 Additional Notes

Questions for Reviewers

  • Does the Laravel compatibility matrix cover all necessary versions?
  • Are the GitHub Actions workflow triggers appropriate?
  • Should we add more Laravel-specific integration tests?

Known Issues/Limitations

  • Laravel 11.x and 12.x have specific PHP version requirements that exclude older PHP versions
  • Test scripts require significant disk space (~500MB) for multiple Laravel installations
  • GitHub Actions workflow may take 15-20 minutes to complete full matrix

Future Improvements

  • Add Symfony framework installation tests
  • Create automated compatibility testing for other major PHP frameworks
  • Add performance benchmarking across different Laravel versions
  • Consider adding database integration tests for Laravel-specific use cases

📊 Test Matrix Added

PHP Version Laravel 9.x Laravel 10.x Laravel 11.x Laravel 12.x
PHP 8.1 ❌* ❌*
PHP 8.2 ❌*
PHP 8.3
PHP 8.4

*Laravel version requirements exclude certain PHP versions


/cc @egyjs

@egyjs egyjs requested a review from Copilot June 23, 2025 00:10
@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

This comment was marked as outdated.

@egyjs egyjs requested a review from Copilot June 23, 2025 00:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces automated Laravel installation testing for the egyjs/progressive-json-php package, updates CI configurations, tightens PHP requirements, and expands documentation around these tests.

  • Add a Bash script (scripts/test-laravel-installation.sh) to spin up fresh Laravel apps (v9–v12), install the package, and verify basic functionality.
  • Introduce a dedicated GitHub Actions workflow (.github/workflows/laravel-installation-test.yml) to run the Laravel compatibility matrix on each push/PR and weekly.
  • Bump composer.json to version 1.1.0, drop PHP 8.0 support (now >=8.1), update Symfony HttpFoundation constraint; update README and docs with installation test instructions.

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/test-laravel-installation.sh New script automating Laravel project creation, package install, and tests
docs/LARAVEL_INSTALLATION_TESTS.md Detailed documentation of the local/CI test script and workflow usage
composer.json Version bump to 1.1.0; require PHP >= 8.1; extend symfony/http-foundation
README.md Updated PHP badge, added Laravel installation test section
.github/workflows/php-tests.yml Removed PHP 8.0 from the PHPUnit test matrix
.github/workflows/laravel-installation-test.yml New workflow for running Laravel installation tests
Comments suppressed due to low confidence (2)

docs/LARAVEL_INSTALLATION_TESTS.md:216

  • Remove or replace this line since there is no 'Troubleshooting' section in this document, or add the missing section with relevant troubleshooting steps.
1. Check the troubleshooting section above

.github/workflows/laravel-installation-test.yml:59

  • Ensure the target tests directory exists before copying; consider adding mkdir -p tests before this command to avoid failures if the directory is missing.
          cp -r ../../tests/* tests/

php -r "
require_once 'vendor/autoload.php';
if (class_exists('Egyjs\ProgressiveJson\ProgressiveJsonStreamer')) {
echo 'Autoloading: ✓' . PHP_EOL;
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the existing print_success function for success messages to maintain consistent colored output formatting instead of raw echo.

Suggested change
echo 'Autoloading: ✓' . PHP_EOL;
echo "\033[0;32m[SUCCESS]\033[0m Autoloading: ✓" . PHP_EOL;

Copilot uses AI. Check for mistakes.
Comment on lines +145 to +157
php -r "
require_once 'vendor/autoload.php';
require_once 'bootstrap/app.php';
\$streamer = new \Egyjs\ProgressiveJson\ProgressiveJsonStreamer();
\$data = ['test' => 'Laravel ' . app()->version(), 'php' => PHP_VERSION];
\$result = \$streamer->stream(\$data);
if (!empty(\$result)) {
echo 'Basic functionality: ✓' . PHP_EOL;
} else {
echo 'Basic functionality: ✗' . PHP_EOL;
exit(1);
}
"
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, replace this raw echo with print_success to keep all success messages consistently formatted.

Suggested change
php -r "
require_once 'vendor/autoload.php';
require_once 'bootstrap/app.php';
\$streamer = new \Egyjs\ProgressiveJson\ProgressiveJsonStreamer();
\$data = ['test' => 'Laravel ' . app()->version(), 'php' => PHP_VERSION];
\$result = \$streamer->stream(\$data);
if (!empty(\$result)) {
echo 'Basic functionality: ✓' . PHP_EOL;
} else {
echo 'Basic functionality: ✗' . PHP_EOL;
exit(1);
}
"
php_output=$(php -r "
require_once 'vendor/autoload.php';
require_once 'bootstrap/app.php';
\$streamer = new \Egyjs\ProgressiveJson\ProgressiveJsonStreamer();
\$data = ['test' => 'Laravel ' . app()->version(), 'php' => PHP_VERSION];
\$result = \$streamer->stream(\$data);
if (!empty(\$result)) {
echo 'SUCCESS: Basic functionality' . PHP_EOL;
} else {
echo 'Basic functionality: ✗' . PHP_EOL;
exit(1);
}
")
if [[ $php_output == SUCCESS:* ]]; then
print_success "${php_output#SUCCESS: }"
else
print_error "${php_output}"
exit 1
fi

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@egyjs egyjs merged commit 01e9700 into master Jun 23, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants