Skip to content

File Structure

Understanding the file structure is crucial for efficiently developing and maintaining services within your Laravel application. Following Laravel's standard conventions, the Orchestration package integrates seamlessly, organizing service-related files in a logical and accessible manner.

.
├─ app
│  ├─ Services
│  │  ├─ Checkout
│  │  │  ├─ Contracts
│  │  │  │  ├─ CheckoutRequester.php
│  │  │  │  └─ CheckoutResponder.php
│  │  │  ├─ AdyenCheckoutRequest.php
│  │  │  ├─ AdyenCheckoutResponse.php
│  │  │  ├─ FakeCheckoutRequest.php
│  └─ └─ └─ FakeCheckoutResponse.php
├─ config
│  ├─ orchestration.php
└─ └─ checkout.php

Services Directory

The 'app/Services' directory is the heart of your orchestrated services, containing each service's contracts, provider gateways, and a fake gateway for testing purposes.

Contracts

Generated by the orchestrate:service command, the 'ServiceRequester.php' and 'ServiceResponder.php' interfaces lay the foundation for defining a standardized communication protocol between your application and its services.

Provider Gateways

For each provider added via orchestrate:provider, 'ProviderServiceRequest.php' and 'ProviderServiceResponse.php' are created respectively. These classes are crucial for integrating your application with the service providers, ensuring seamless communication.

Testing

The 'FakeServiceRequest.php' and 'FakeServiceResponse.php' classes, generated along with the service, are designed for mocking the responses for it, facilitating robust testing environments.

Customization

Flexibility is key in Laravel, and orchestration adheres to this principle. You can reorganize your services to fit your application's needs by updating the service-specific configuration file to reflect the new paths for your service provider gateways.

For example, to update the location of the Adyen gateway for the checkout service:

php
return [

    'providers' => [

        'adyen' => [
            'gateway' => \App\Services\Checkout\Adyen\AdyenCheckoutRequest::class,
        ],

    ],

];

This structure and organization facilitate a modular and maintainable approach to service orchestration within your Laravel application, ensuring that your services are both scalable and easy to manage.