Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for laravel 7 and 8 #1

Merged
merged 4 commits into from
Jun 13, 2022
Merged

Conversation

lakuapik
Copy link
Member

This PR not just adding support for laravel 7 and 8, but also refactoring the core and improve documentation.

@axmad386 please kindly review and discuss features here.

@lakuapik lakuapik requested a review from axmad386 June 12, 2022 15:50
Copy link
Member

@axmad386 axmad386 left a comment

Choose a reason for hiding this comment

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

Awesome work @lakuapik. I want to discuss something

  • I think php-cs-fixer didn't work properly. Check my comments.
  • how about laravel 5 and 6? it is possible to support them?
  • Should we include documentation how to customize response structure? I think we need to mention toResponse method part

src/Exceptions/ApiException.php Outdated Show resolved Hide resolved
tests/ApiExceptionTest.php Outdated Show resolved Hide resolved
@lakuapik
Copy link
Member Author

@axmad386 i run compsoser test again.

❯ date; git branch --show-current; composer test
Mon Jun 13 10:58:00 AM WIB 2022
support-laravel-7-and-8
> php-cs-fixer fix --allow-risky=yes
Loaded config default from "/media/d/data/work/labs/laravel-api-response/.php-cs-fixer.php".
Using cache file ".php-cs-fixer.cache".

Fixed all files in 0.006 seconds, 16.000 MB memory used
> pest --stop-on-failure

   PASS  Tests\ApiExceptionTest
  ✓ it can handle ApiException
  ✓ it returns HTTP_BAD_REQUEST for ApiException by default
  ✓ it can handle ApiValidationException
  ✓ it can access route with validated parameters

   PASS  Tests\ApiResponseTest
  ✓ it returns correct response header
  ✓ it returns correct json structure for success api response
  ✓ it returns correct json structure for error api response
  ✓ it fails when the argument $data is not valid
  ✓ it fails when the argument $errors is not valid

  Tests:  9 passed
  Time:   0.41s

Off course we could also support laravel 5 and 6, but we need to ditch pestphp and move to phpunit. pest require minimum version of php 7.3. which is doable for laravel 7. for laravel 5 and 6, it can run below 7.3.

@axmad386
Copy link
Member

axmad386 commented Jun 13, 2022

Off course we could also support laravel 5 and 6, but we need to ditch pestphp and move to phpunit. pest require minimum version of php 7.3. which is doable for laravel 7. for laravel 5 and 6, it can run below 7.3.

Oh I see. Then it's better to exclude laravel 5 and 6 for now.

Copy link
Member

@axmad386 axmad386 left a comment

Choose a reason for hiding this comment

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

Everything is ok, let's merge this to the main branch

@lakuapik lakuapik merged commit 1b961db into main Jun 13, 2022
@lakuapik lakuapik deleted the support-laravel-7-and-8 branch June 13, 2022 07:31
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.

2 participants