Download the PHP package scafera/integration without Composer

On this page you can find all versions of the php package scafera/integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package integration

scafera/integration

External system communication for the Scafera framework. Provides an enforceable gateway pattern for calling third-party APIs — all behind Scafera-owned types.

Internally adopts symfony/http-client. Userland code never imports Symfony HttpClient types — boundary enforcement blocks it at build time. All alternative HTTP mechanisms (cURL, file_get_contents with HTTP URLs) are also blocked.

Provides: External system communication for Scafera — a gateway pattern where each class wraps one third-party system with business-level methods. HttpClient (5 methods: get/post/put/patch/delete) and Response (statusCode/json/body/headers/header) are Scafera-owned types; gateways wire up via #[Integration]. All HTTP escape hatches (Symfony HttpClient, cURL, file_get_contents/fopen with HTTP URLs) are blocked outside Integration/.

Depends on: A Scafera host project with an Integration/ layer (e.g. src/Integration/ under App\Integration). Per-integration config under integration: in config/config.yaml; secrets belong in config.local.yaml (git-ignored).

Extension points:

  • Attribute — #[Integration('name')] resolves to the configured HttpClient; #[Integration('name', 'key')] resolves to a per-integration config value (ADR-065)
  • User gateways — one class per external system in Integration/..., class name must end with Gateway (enforced by GatewayNamingValidator), business-level methods only
  • Config — integration: section in config/config.yaml declares each integration's base_url, auth, and any custom keys (injectable via the two-arg attribute)
  • Testing — HttpClient constructor accepts an optional HttpClientInterface (e.g. MockHttpClient) for test doubles; the bundle never passes it in production

Not responsible for: Raw HTTP outside Integration/ (Symfony HttpClient, cURL, file_get_contents/fopen with HTTP URLs — blocked by HttpClientLeakageValidator, HttpClientBoundaryValidator) · auto-throwing on HTTP errors (Response never throws; the gateway decides) · full URLs in gateway methods (relative paths only; base URL from config) · secret storage (belongs in config.local.yaml, not config.yaml) · unused integration: config keys (flagged by UnusedIntegrationConfigValidator).

This is a capability package. It adds optional external system integration to a Scafera project. It does not define folder structure or architectural rules — those belong to architecture packages.

What it provides

Design decisions

Installation

The bundle is auto-discovered via Scafera's symfony-bundle type detection. No manual registration needed.

Requirements

Configuration

If an integration has different base URLs per environment (e.g., sandbox vs production), override base_url in config.local.yaml as well.

Gateway

A gateway is one class per external system with business-level methods:

Gateway rules

Using a gateway in a service

Services inject gateways via constructor — same as any Scafera dependency:

Integration-specific configuration

Integrations can carry arbitrary config values beyond base_url and auth. These are registered as container parameters and injected via the same #[Integration] attribute with a second argument:

The gateway receives config values alongside the HttpClient:

#[Integration('name')] without a second argument resolves to the HttpClient service. #[Integration('name', 'key')] resolves to the config value. The HttpClient itself has no awareness of these values — they are resolved by the container before the gateway is constructed.

HttpClient API

The $data array is sent as JSON body. For other content types (form-encoded, multipart), use the $options array directly (e.g., $this->http->post('/upload', [], ['body' => $formData])).

Response API

HTTP errors do not throw automatically — error handling is the gateway's responsibility.

Testing

Testing services that use gateways

Mock the gateway, not the HTTP client:

Testing gateways themselves

The HttpClient constructor accepts an optional HttpClientInterface for testing — the bundle never passes it (engine stays hidden in production):

Boundary enforcement

Blocked Use instead
Symfony\Contracts\HttpClient\* Scafera\Integration\HttpClient in a Gateway class
Symfony\Component\HttpClient\* Scafera\Integration\HttpClient in a Gateway class
curl_* functions Scafera\Integration\HttpClient in a Gateway class
file_get_contents with HTTP URLs Scafera\Integration\HttpClient in a Gateway class
fopen with HTTP URLs Scafera\Integration\HttpClient in a Gateway class
Scafera\Integration\HttpClient outside Integration/ Inject the gateway, not the HTTP client
#[Integration('name', 'key')] outside Integration/ Integration config values belong in gateways only
Unused config keys under integration: Remove unused keys or reference them in a gateway

Enforced via validators (scafera validate). The HttpClient and integration config values are only allowed inside the Integration/ layer — services and controllers inject gateways, not HTTP clients or integration config.

License

MIT


All versions of integration with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
scafera/kernel Version ^1.0
symfony/http-client Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package scafera/integration contains the following files

Loading the files please wait ...