refactor: update the code as the laravel best practices#524
Open
huzaifaarain wants to merge 2 commits intoShopify:mainfrom
Open
refactor: update the code as the laravel best practices#524huzaifaarain wants to merge 2 commits intoShopify:mainfrom
huzaifaarain wants to merge 2 commits intoShopify:mainfrom
Conversation
Author
|
I have signed the CLA! |
…o their own controllers.
dharanikumar07
pushed a commit
to dharanikumar07/survey-app
that referenced
this pull request
Nov 15, 2025
…, config) - Add `app/Providers/ShopifyServiceProvider.php` to initialize Shopify Context, force HTTPS, and register webhooks (incl. privacy topics) - Slim `app/Providers/AppServiceProvider.php` by removing Shopify-specific logic - Centralize Shopify envs in `config/shopify.php` (`api_key`, `api_secret`, `scopes`, `custom_domains`, `api_version`) and use `config()` at runtime - Register `App\Providers\ShopifyServiceProvider` in `config/app.php` - Replace route closures with controllers: - `app/Http/Controllers/AuthController.php` for `/api/auth` and `/api/auth/callback` - `app/Http/Controllers/WebhookController.php` for `/api/webhooks` - `app/Http/Controllers/SpaController.php` as `Route::fallback` - Update `routes/web.php` to reference new controllers - Delete unused `app/Http/Controllers/ShopifyOAuthController.php` BREAKING CHANGE: removed `/api/products` and `/api/products/count` endpoints (by request). Inspired by Shopify template refactor: Shopify/shopify-app-template-php#524
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor the code as per Laravel best practices
After building couple of applications using this template I came across couple of issues and I have tried to address those in the PR to the best of my knowledge.
Using
envdirectly in the service provider is not recommended. Allenvvalues should be resolved viaconfig.Decoupled shopify related business logic from
AppServiceProvider, extract the logic into its own service providerShopifyServiceProviderImplementing business logic directly into the
web.phpis not recommended. I have also organized theweb.phpfile by moving the business logic to its own namespace and relevant controllers.