Download the PHP package thombas/revised-service-pattern without Composer
On this page you can find all versions of the php package thombas/revised-service-pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download thombas/revised-service-pattern
More information about thombas/revised-service-pattern
Files in thombas/revised-service-pattern
Package revised-service-pattern
Short Description A package that adds a service pattern which extends from the established models.
License MIT
Informations about the package revised-service-pattern
Revised Service Pattern for Laravel
🚀 Introduction
Revised Service Pattern is a Laravel package that extends Laravel’s native HTTP client with a clean, structured singleton-based service pattern for interacting with third-party RESTful APIs.
It’s built for developers who want:
- ✅ Rapid third-party API integration
- ✅ Organized endpoint structure
- ✅ Full compatibility with Laravel's HTTP tools
✨ Features
- Lightweight and framework-friendly
- Singleton-based API access pattern
- Extends Laravel’s
Http
facade for consistency - Auto-discovered endpoints and templates
- Artisan commands for bootstrapping services, templates, and stubs
- Testing-friendly with no boilerplate or conditional logic pollution
📦 Installation
🛠️ Getting Started
1️⃣ Create a Base Service
Define your base service to handle global API config (e.g. base URL, headers, auth).
2️⃣ Create Endpoint Services
Endpoints extend your base service. Each represents one API route and defines method, URL, and parameters.
✅ Best Practice: Keep one class per endpoint for maintainability and clear logic separation.
⚙️ Artisan Commands
Scaffold services and templates using built-in Artisan commands.
Add an endpoint directly:
Use subdirectories for grouping:
Note: Both
/
and\
are accepted as path separators.
📡 Endpoint Lifecycle
Endpoint classes support full control over request logic using lifecycle hooks:
__construct()
Receive parameters:
setup()
Configure request:
before()
Optional pre-request logic (e.g. caching):
validate()
Inspect API response and throw errors:
after()
Post-request processing (e.g. caching, saving):
format()
Return response in preferred format:
🧩 Accessing Endpoints
Use your service to statically call any registered endpoint:
- Endpoints must be in the same directory as your base service.
- Each endpoint class name must be unique to avoid conflicts.
📦 Templates
Templates structure and validate input payloads for your endpoints.
Example
Use as a parameter:
🧪 Testing
Run PHPUnit tests with:
📜 Changelog
Check out the CHANGELOG for version history.
🤝 Contributing
Contributions are welcome!
See CONTRIBUTING.md.
🔒 Security
For security concerns, please refer to our security policy.
🏆 Credits
🪪 License
Licensed under the MIT License.
All versions of revised-service-pattern with dependencies
spatie/laravel-package-tools Version ^1.12
laravel/framework Version >=10.0