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

Targito Api Laravel Package

targito/targito-api

A PHP client for the Targito marketing automation API, making it easy to manage contacts, lists, campaigns, and events from Laravel or any Composer-based application. Simplify email/SMS marketing integrations with a straightforward SDK.

View on GitHub
Deep Wiki
Context7

Getting Started

composer require targito/targito-api

This is a plain PHP SDK, not a Laravel package — expect no service provider, facade, or auto-discovery. First steps:

  1. Read the README and src/ before anything else. With a single-digit star count and one release (May 2023), the source is the documentation. Identify the main client class (typically Targito\Api\...) and its constructor signature — it usually takes an account identifier plus an API key/token.
  2. Get credentials from the Targito panel (account ID and API key/token). Put them in config/services.php:
'targito' => [
    'account_id' => env('TARGITO_ACCOUNT_ID'),
    'api_key'    => env('TARGITO_API_KEY'),
    'base_url'   => env('TARGITO_BASE_URL', 'https://api.targito.com'),
],
  1. Bind the client as a singleton in a small TargitoServiceProvider so you inject it rather than new-ing it in controllers:
$this->app->singleton(TargitoClient::class, fn ($app) => new TargitoClient(
    config('services.targito.account_id'),
    config('services.targito.api_key'),
));

First use case: a newsletter signup. On Registered or a form submission, call the SDK's contact/upsert method to add the email to a Targito list. That validates credentials, base URL, and error handling in one small, low-risk path before you build anything larger.

Implementation Patterns

Wrap, don't sprinkle. The SDK will leak into controllers quickly if you call it directly. Create App\Services\Targito\TargitoService that exposes intent-named methods (subscribeContact, unsubscribeContact, syncContact) and hides the SDK types. This is your seam for testing and for swapping the SDK if it stalls.

Queue the calls. Every Targito call is a network round trip. Push contact syncs onto a job:

SyncContactToTargito::dispatch($user)->onQueue('integrations');

Use $tries = 3, backoff = [10, 60], and a failed() handler that logs the payload. Never let a marketing-platform outage break registration.

Event-driven sync. Wire domain events (Registered, ProfileUpdated, OrderPlaced) to listeners that translate your model into the SDK's contact payload. Keep the mapping in one place — a ContactMapper or a toTargito() method on a DTO — so field renames in Targito are a one-file change.

Bulk imports. For backfills, chunk your Eloquent query (->chunkById(500)) and check whether the SDK has a batch/bulk endpoint. If it only has single-record calls, wrap each in rescue() inside a job so one bad email doesn't fail the whole batch, and throttle with RateLimited or usleep.

Testing. Since there's no built-in fake, define an interface (ContactGateway) implemented by the SDK adapter and a FakeContactGateway in tests. In feature tests, $this->swap(ContactGateway::class, $fake) and assert on recorded calls. For integration tests, use Http::fake() — the SDK almost certainly uses Guzzle under the hood, but confirm; if it uses its own transport, you may need to point base_url at a local stub server.

Webhooks. If Targito supports outbound webhooks, register a route and verify the signature/token per their docs. Treat webhook handlers like any external input: validate, queue, respond 200 fast.

Gotchas and Tips

  • Maintenance risk is the headline. One star, zero dependents, a single 2023 release. Treat it as a thin HTTP wrapper you may need to fork. Pin the version ("targito/targito-api": "1.0.*") so an unexpected tag doesn't break you, and keep your TargitoService wrapper thin enough to reimplement over Laravel's Http client in an afternoon if needed.
  • Guzzle version conflicts. Old SDKs often lock guzzlehttp/guzzle:^6 or ^7.0 narrowly, which can clash with your Laravel version. If Composer refuses, check composer why-not guzzlehttp/guzzle first; a fork with a widened constraint is usually cleaner than downgrading Laravel.
  • No exception hierarchy you can rely on. Assume generic \Exception or a single SDK exception. Catch broadly at your service boundary, log getMessage() plus the request context, and translate into your own TargitoException. Without this, a 401 (bad key) and a 429 (rate limit) look identical in logs.
  • Rate limiting. There's likely no built-in retry/backoff. Implement it in your wrapper: retry on 429/5xx with exponential backoff, never on 4xx validation errors.
  • Silent config drift. If the base URL or account ID is wrong, you may get confusing errors deep in a response body. Log the resolved base_url and account ID once at boot in non-production, and sanity-check credentials with a single GET during deployment.
  • Debugging. Enable transport-level logging — pass a Guzzle debug => true handler or wrap with Laravel's Http::withOptions(['debug' => ...]) if you fork. Also log the request payload (redact emails/keys) before the call; the most common bug is a field-name mismatch that Targito rejects with a vague message.
  • Extension points to look for: whether the client accepts a custom HTTP client or handler stack in its constructor. If it does, inject a Guzzle client with retry middleware and a logger and you get most of the resilience you'd otherwise have to fork for. If it doesn't, subclassing or a facade wrapper is your only lever.
  • Environment separation. Keep sandbox and production API keys in separate env vars and guard with a config check that refuses to boot with a production key when APP_ENV=local. Contact-data mistakes are hard to undo.
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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
cgv/localized-resource