djouamaah/laravel-algeria-sms
A Laravel package for integrating Algerian SMS gateways into your applications, offering a simple way to send text messages and add SMS notifications to your PHP projects.
Architecture fit
djouamaah/laravel-algeria-sms is a domain-specific Laravel package rather than a generic SMS abstraction. It follows idiomatic Laravel conventions: a facade (AlgeriaSms), a notification channel (algeria-sms), a validation rule (AlgerianMobile), package events (MessageSent, MessageFailed), a publishable config file, a packaged migration (sms_opt_outs), a queue-aware marketing path, and a fake() testing double. For any Laravel application serving Algerian users — e-commerce checkout OTP, delivery notifications, cash-on-delivery confirmation, promotional campaigns — this maps directly onto existing app architecture with no adapter layer required. The extension point (AlgeriaSms::extend()) plus a generic configurable http driver means the package owns the domain logic (OTP lifecycle, opt-out compliance, segmentation, quiet hours, number normalization) while delegating the transport contract to us. That is the correct split: it keeps vendor-specific API shape out of our codebase while removing the tedious, error-prone parts (GSM-7 vs UCS-2 counting, 05/06/07 carrier detection, accented-character transliteration) that we would otherwise reimplement badly.
Integration feasibility
Install is three commands (composer require, php artisan migrate, vendor:publish), and the public API surface is small and legible: send(), otp()->send()/verify(), marketing(), optOut()/optIn()/isOptedOut(). The log driver provides a zero-dependency local path, so integration work can begin before any commercial contract with a carrier or aggregator exists. The critical caveat is stated plainly in the release notes: Algerian carriers and local providers do not publish API documentation, so the http driver must be configured from the provider's own docs after contracting, or a bespoke driver written via extend(). That makes provider onboarding the real integration cost, not the package itself — budget it as a distinct workstream.
Technical risk
http driver shifts provider-specific concerns (auth scheme, payload shape, encoding, response codes, rate-limit semantics) onto our configuration. Every provider is a fresh, undocumented integration exercise.MessageSent appears to fire on successful API call, not on handset delivery. For OTP and transactional use we should assume "accepted by gateway" ≠ "delivered," and plan accordingly.Key questions
http driver support delivery-report (DLR) callbacks, or is that left entirely to the application?APP_KEY, and are comparisons constant-time and caps scoped per phone+purpose?http 5xx and 429 responses?AlgeriaSms::fake() cover OTP verification flows and opt-out state, or only outbound sends?Stack fit
Fit is high and narrow: Laravel app, PHP, queue worker already running, MySQL/Postgres for the sms_opt_outs migration. It slots in beside existing mail/notification infrastructure rather than replacing it — we keep Laravel's notification system as the dispatch surface and use the package as the algeria-sms channel. The AlgerianMobile validation rule should be standardized at the form-request layer so phone normalization is consistent from input through to send, which is where most SMS bugs in this domain actually originate.
Migration path
There is nothing to migrate from unless we currently send via a raw HTTP client or an international aggregator. If we do, the path is: (1) wrap the existing sender behind AlgeriaSms::extend() so both paths produce identical payloads; (2) run the new package in shadow mode alongside the incumbent for a pilot cohort, comparing normalization, segmentation, and delivery outcomes; (3) cut over per use case (OTP first, then transactional, then marketing) rather than per environment. If we are greenfield, start with log, then a single http connection, then marketing.
Compatibility
Two compatibility surfaces matter. First, Laravel/PHP version support — pin the package version in composer.json and validate against our framework version in CI before merging. Second, provider compatibility: the http
Sequencing
log driver end-to-end, stand up AlgeriaSms::fake() in the test suite. Confirm PHP/Laravel matrix. No provider needed.http driver or write an extend() driver against the contracted provider. Capture the provider's error taxonomy explicitly; this is where undocumented-API risk concentrates.MessageSent/MessageFailed into observability, add the AlgerianMobile rule to registration and checkout forms, and set OTP expiry/caps to match our security policy.sms_opt_outs, expose opt-out on every marketing message path, and verify quiet-hours behavior in a staging timezone test.Deliberately deferring marketing until last keeps the highest-volume, highest-regulatory-risk path off the critical path for launch.
Maintenance
Ongoing cost is low but non-zero: track 1.x releases for a young package, re-verify after each Laravel major upgrade, and re-verify after any provider API change — the latter is the more likely breakage since the transport contract is ours, not the package's. Expect the accent-transliteration (gsm()) and segmentation logic to be the parts most likely to need local patches for edge cases (mixed Arabic/Latin content, emoji, URLs in message bodies). Keep such patches as thin application-side overrides rather than forks.
Support Documentation and API surface are Arabic-first with French/English message templates, which suits an Algerian product team; ensure at least one engineer can read the docs unaided. Support load will be dominated by provider issues, not package issues — so the operational runbook should be organized around the provider relationship (credentials rotation, sender-ID registration, rate-limit ceilings, escalation contact) rather than around the package.
Scaling
Marketing throughput is bounded by the queue and by the provider's rate limits, not by the package; the batching and opt-out filtering design is appropriate. OTP and transactional sends are synchronous HTTP calls and will be the latency-sensitive path — set explicit connect/read timeouts and a bounded retry policy so a slow provider cannot tie up request workers. If volume grows past a single provider's capacity, the extend() mechanism permits multiple named connections, but failover across providers is not described and should be assumed to be our responsibility.
Failure modes
MessageFailed rate and a user-facing "resend code" path that respects the resend cap.gsm() and the segment counter.Ramp-up
Ramp-up is genuinely short for a Laravel team: the facade and notification channel are idiomatic, the log driver and fake() let engineers work without credentials, and the example block is close to copy-pasteable. Realistically one engineer can complete steps 1–4 above in a sprint or two, with the provider contract as the pacing item. The knowledge that must be deliberately transferred rather than absorbed: (a) the provider's error taxonomy and how we map it to retries, (b) the compliance rules baked into quiet hours and opt-out — why they exist, and why they must not be "temporarily" bypassed for a campaign deadline, and (c) the OTP security parameters, so that a future engineer does not casually extend expiry or raise the attempt cap. Write those three down as decision records at adoption time; they are the parts most likely to be eroded silently.
How can I help you explore Laravel packages today?