Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Finance Consult Api Client Laravel Package

gonetto/finance-consult-api-client

A PHP client for the Gonetto Finance Consult API, wrapping remote endpoints in a clean, Laravel-friendly interface so you can query consulting data and handle responses without hand-rolling HTTP calls.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony bundle, not a Laravel package. There is no ServiceProvider, no config/*.php publish tag, and no facade. A Laravel developer's first job is to figure out whether the bundle is just a thin DI wrapper around a usable client (good) or whether the client logic is entangled with Symfony's container (painful).

Minimal path:

  1. Install it and immediately inspect what it pulled in:

    composer require gonetto/finance-consult-api-client
    

    Open vendor/gonetto/finance-consult-api-client/composer.json first. You care about:

    • require — does it hard-depend on symfony/http-kernel, symfony/dependency-injection, symfony/config, symfony/http-client, symfony/serializer? Those are the friction points against a Laravel app.
    • autoload — where the actual API client class lives (usually src/), separate from the bundle glue (DependencyInjection/, Resources/config/, *Bundle.php).
  2. Find the real client class. In src/, look for something like *Client.php or *ApiClient.php, plus a DependencyInjection/Configuration.php (this tells you every config key the bundle expects: base URL, API key, timeout, etc.) and Resources/config/services.yaml (this tells you how the client is constructed — constructor args, injected HTTP client, serializer).

  3. First use case — bypass the bundle entirely. Write a throwaway Artisan command (php artisan make:command ProbeFinanceConsult) that news up the client manually with credentials from .env, calls one read-only endpoint, and dump()s the raw response:

    // app/Console/Commands/ProbeFinanceConsult.php
    $client = new \Gonetto\FCApiClient\Client(
        baseUrl: config('services.finance_consult.base_url'),
        apiKey:  config('services.finance_consult.api_key'),
    );
    
    $response = $client->someReadMethod(/* ... */);
    dump($response);
    

    Getting one raw response out is the fastest way to learn the DTO shapes, auth header format, and error envelope before you commit to any integration architecture.

Implementation Patterns

Pattern A — Standalone client behind your own interface (recommended)

Treat the package as a library and hide it behind an interface you control. This is the only sane approach for a 0-star dependency.

namespace App\Services\FinanceConsult;

interface FinanceConsultClient
{
    public function getConsultation(string $id): ConsultationData;
    public function listContracts(array $filters = []): array;
}
namespace App\Services\FinanceConsult;

use Gonetto\FCApiClient\Client as GonettoClient;

final class GonettoFinanceConsultClient implements FinanceConsultClient
{
    public function __construct(private GonettoClient $client) {}

    public function getConsultation(string $id): ConsultationData
    {
        $raw = $this->client->getConsultation($id); // Symfony DTO or array

        return ConsultationData::fromArray((array) $raw);
    }
}

Pattern B — Recreate the bundle's service wiring in a service provider

Read Resources/config/services.yaml and translate constructor arguments into a Laravel singleton. Map Symfony parameters (%gonetto_fc.api_key%) to config() calls.

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Gonetto\FCApiClient\Client;

class FinanceConsultServiceProvider extends ServiceProvider
{
    public function register(): void
    {
        $this->mergeConfigFrom(config_path('finance-consult.php'), 'finance-consult');

        $this->app->singleton(Client::class, fn ($app) => new Client(
            baseUrl: $app['config']->get('finance-consult.base_url'),
            apiKey:  $app['config']->get('finance-consult.api_key'),
            httpClient: $app->make(\GuzzleHttp\Client::class), // if the client accepts an HTTP client
        ));

        $this->app->bind(FinanceConsultClient::class, GonettoFinanceConsultClient::class);
    }
}

Common workflows

  • Config file — mirror the bundle's Configuration.php tree into config/finance-consult.php. Keep the keys 1:1 with the Symfony tree so that if the package is ever fixed for Laravel you can reconcile easily.
  • Auth / token refresh — check for a token/refresh service in src/. If it exists, wire it as a singleton and refresh inside a queued job, not per-request. Store tokens in cache, not in the DB.
  • DTO → Eloquent — map the client's response DTOs to your models in a dedicated mapper class, not in controllers. API shapes from a 0-star package will change; isolate the mapping.
  • Background sync — drive all calls from queued jobs with $tries, backoff(), and a failed() handler. Financial APIs are usually slow and rate-limited.
  • HTTP faking in tests — if the client uses Guzzle, Http::fake() won't intercept it. Either swap the injected Guzzle client in a test binding, or mock your FinanceConsultClient interface at the boundary. The interface approach makes tests trivial.
// tests
$this->mock(FinanceConsultClient::class)
    ->shouldReceive('getConsultation')
    ->once()
    ->andReturn(new ConsultationData(id: 'abc', /* ... */));

Integration tips

  • Don't boot the Bundle class. Symfony's Bundle::boot() relies on the kernel and container internals that Laravel doesn't have. Just skip the bundle and use the classes underneath.
  • Version-pin it. "gonetto/finance-consult-api-client": "1.0.*" or even a commit hash. Zero dependents means zero incentive to maintain BC.
  • Log every request/response in the wrapper (redact auth headers). When the API misbehaves, you'll want the raw bodies.

Gotchas and Tips

  • Framework coupling is the first thing to check. If composer.json requires symfony/http-kernel, composer will install the whole Symfony HTTP stack alongside Laravel. That's usually fine (they coexist), but if the package requires an incompatible Symfony major version you'll hit a dependency resolution wall. Run composer why-not laravel/framework if install refuses.
  • %env()% placeholders won't resolve. Symfony's config tree resolves %env(GONETTO_API_KEY)% at container compile time. In Laravel, config('finance-consult.api_key') will return the literal "%env(...)%" string. Always map env vars manually in the config file.
  • Service tags and event dispatchers don't exist here. If the bundle registers tagged services, Symfony event subscribers, or cache pools in services.yaml, you must reimplement them as Laravel bindings / listeners / cache repositories. Grep services.yaml for tags: before assuming it's trivial.
  • Serializer dependency. If the client depends on symfony/serializer for DTO hydration, you're now carrying that component. It works standalone, but be aware that its normalizer configuration differs from Laravel's conventions — don't try to share your JsonResource layer with it.
  • Symfony HttpClient vs Guzzle. If the client type-hints Symfony\Contracts\HttpClient\HttpClientInterface, you'll need to install symfony/http-client and cannot just hand it a Guzzle client. If it type-hints Guzzle, you can share Laravel's Guzzle instance — check before designing.
  • Exception handling. The client will throw its own exceptions (likely extending Symfony's or the package's own base). Wrap every call in the adapter and rethrow as your own FinanceConsultException hierarchy so your app's Handler config stays coherent.
  • No docs, no issues, no maintainers. With 0 stars and 0 dependents there is no community to lean on. Budget time for reading src/ end-to-end. If the package is critical, consider vendoring the client class into app/Services/FinanceConsult/Vendor/ so a future removal of the repo doesn't break you.
  • Debugging checklist when nothing works: (1) dump the constructor args from services.yaml; (2) confirm the auth header actually reached the wire with Http::fake-style middleware or a Guzzle on_stats callback; (3) inspect the raw JSON body, not the hydrated DTO — DTO hydration is where silent failures hide; (4) check for API version prefixes in the base URL.
  • Extension points are limited to whatever the bundle exposes: constructor args on the client and the Configuration.php keys. There's no middleware pipeline out of the box — if you need retries, rate limiting, or circuit breaking, wrap the client and implement them yourself rather than hoping the package does.
  • Migration escape hatch. Because you wrapped it behind FinanceConsultClient, replacing this package with a hand-rolled Http:: client is a one-file change. Given the package's health signals, plan for that day.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo