Download the PHP package kpaph/msg4wrdio without Composer
On this page you can find all versions of the php package kpaph/msg4wrdio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package msg4wrdio
About MSG4wrd
MSG4wrd is an SMS Gateway and Message Forwarder API formerly known as PTXT4wrd.
From 2005 to 2012, in the Philippines, some networks only allowed text messaging within the same network. Promos were available for unlimited texting to the same network, such as SMART to SMART or GLOBE to GLOBE only.
To address this issue, PTXT4wrd was invented, which allows users to send messages to other networks by forwarding their texts from their own network.
Example command for sending a message to other networks:
PTXT{space}OtherNetworkNumber{space}YourMessage then send to Gateway.
PTXT 09171234567 Hello world! Then, send to gateway number.
Gateways - SMART / GLOBE / SUN If you are smart, you will use SMART Gateway, identical to the other networks.
Requirements
- PHP
^8.1 - Laravel
8.x–13.x guzzlehttp/guzzle^6.3,^7.2, or^8.0(whichever your app already resolves). If Guzzle isn't installed or can't be constructed, the package automatically falls back to PHP'sext-curl— no configuration needed, but thecurlextension must be enabled.
Installation
composer require kpaph/msg4wrdio
The service provider is auto-discovered by Laravel — no manual registration in config/app.php is required.
Publish the config file (config/msg4wrdio.php):
php artisan vendor:publish --tag=msg4wrdio-config
Add your token to .env. Get a token at MSG4wrd.io:
Demo routes (optional, disabled by default)
The package ships with demo routes (/msg4wrd, /msg4wrd/send, /msg4wrd/send-with-options) for smoke-testing. They are unauthenticated and can trigger SMS sends billed to your token, so they are disabled by default. To enable them in local environments only:
With the demo routes enabled you can check the install:
And trigger a test send:
Note: Only +63 (Philippines mobile) and +1 (US / Canada) numbers are accepted. A leading + and common separators (spaces, dashes, dots, parentheses) are stripped automatically. Examples of valid input: +63 917 123 4567, 639171234567, +1 (202) 664-5435, 12026645435.
Usage
Create a controller, e.g. SMSController:
Configuration reference
| Env variable | Default | Purpose |
|---|---|---|
MSG4wrdIO_TOKEN |
(empty) | Bearer token from MSG4wrd.io. |
MSG4wrdIO_DOMAIN |
https://api.msg4wrd.io |
Live (production) API base URL. |
MSG4wrdIO_DEVELOPER |
https://staging.msg4wrd.io |
Sandbox / staging API base URL, used when dev_mode=true. |
MSG4wrdIO_DEV_MODE |
false |
When true, requests go to the sandbox URL; when false, they go to live. |
MSG4wrdIO_DEFAULT_COUNTRY |
PH |
Default country if $options["country"] is omitted. |
MSG4wrdIO_EXPOSE_DEMO_ROUTES |
false |
Opt-in to register the unauthenticated /msg4wrd* demo routes. |
Changelog
Unreleased — Guzzle 6/7/8 support + cURL fallback + bug fixes
- Wider Guzzle compatibility.
guzzlehttp/guzzleconstraint widened from^7.2to^6.3|^7.2|^8.0. If your app already has Guzzle 6 or 8 resolved by another package, this package no longer forces a conflicting upgrade/downgrade to Guzzle 7. - Automatic cURL fallback. If Guzzle is missing entirely, or its installed version can't be constructed (e.g. a broken or conflicting install),
MSG4wrd::Send()now transparently falls back to a rawext-curlrequest with the same request/response shape — no code changes needed on your end. Requires the PHPcurlextension (bundled and enabled by default in virtually all PHP installs). - No fallback on network failures. A genuine network error (timeout, DNS failure, connection refused) during an actual Guzzle request is reported as a failure, not silently retried over cURL — retrying an in-flight request on a second transport could otherwise trigger a duplicate SMS send if the first attempt had already reached the upstream API.
MSG4wrdIO_DEFAULT_COUNTRYnow actually works. Previously this config value was published and documented but never read —checkCountry()always fell back toPHregardless of the setting. It now honorsMSG4wrdIO_DEFAULT_COUNTRY(accepting the same enum/int/alias forms as thecountryoption) whenever$options['country']isn't explicitly passed toSend().- Demo controller no longer coupled to the host app.
SampleControllerextended the consuming application'sApp\Http\Controllers\Controller; it now extendsIlluminate\Routing\Controllerdirectly, so it no longer depends on the host app having that exact class. - Demo routes no longer 500 on a missing
number./msg4wrd/sendand/msg4wrd/send-with-optionspassed the raw (possibly-null) query param intoSend(string $number, ...), which threw aTypeErrorwhennumberwas omitted. It's now cast to a string first, so a missing number returns the normal "Invalid number" response instead of a server error.
v2026.7.1 — Laravel 13 support
- Laravel 13 support.
illuminate/supportnow allows^13.0, so the package installs cleanly on Laravel 13. Verified againstlaravel/framework v13.18.1on PHP 8.4. Existing Laravel 8–12 apps are unaffected. - No code or config changes. This is a dependency-constraint-only release — nothing in your app needs to change. Just bump to
v2026.7.1(see Upgrading).
Fixes
- Country option now actually works.
checkCountry()was comparing theCountryint-backed enum to the string"US", soCountry::USsilently fell through toCountry::PH. The helper now accepts aCountryenum, an int matching the enum value, or the string"US"/"PH". - Number validation. Renamed
chechNumberCountryCode→checkNumberCountryCodeand tightened the rules: only+63(PH mobile) and+1(US/CA) numbers are accepted. PH numbers must start with9after the country code; NANP numbers must have valid area + exchange codes (2-9). A leading+and common separators (space, dash, dot, parentheses) are stripped automatically. New helpersnormalizeNumber()anddetectCountry()are exposed alongsidecheckNumberCountryCode(). checkCountry()aliases. Accepts aCountryenum, the int value, or string aliases —PH/PHL/PHILIPPINESresolve toCountry::PH, andUS/USA/CA/CAN/CANADAresolve toCountry::US.- HTTP client. Removed dead Guzzle 3 exception imports, removed the brittle
(int)phpversion() < 8cURL fallback, fixed the stray space inAuthorization: ' Bearer ', added a 30s timeout, and any 2xx response is now treated as success. Non-2xx responses surface the upstream body and status instead of being collapsed to a genericSending failed.message. - Live / sandbox switch. The config now exposes separate
liveandsandboxURLs. SetMSG4wrdIO_DEV_MODE=trueto route requests to the sandbox (MSG4wrdIO_DEVELOPER); leave itfalsefor the live URL (MSG4wrdIO_DOMAIN). - Service provider. Moved
mergeConfigFrom()out ofboot()intoregister()where it belongs, removed the eagerapp->make(SampleController::class)call fromregister()(controllers should be resolved by the router), and the config publish is now gated behindrunningInConsole()and tagged asmsg4wrdio-config. Send()ergonomics.$optionsnow merges over defaults, so you can pass just the keys you care about.sendernameaccepts either aSenderNameenum or a custom brand-ID string.priorityis cast toint. A leading+is stripped from the mobile before sending.
Security
- Demo routes are off by default.
/msg4wrd,/msg4wrd/send, and/msg4wrd/send-with-optionswere previously auto-registered on every consuming app — anyone who could reach the app could trigger SMS sends billed to your token. They are now gated behindMSG4wrdIO_EXPOSE_DEMO_ROUTES=true. This is a breaking change if you relied on those routes — set the env var to re-enable them. - Removed the placeholder
[SECRET-TOKEN]default fromconfig/msg4wrdio.php; the token now defaults to an empty string. - Removed tracked
.DS_Storefiles and added a.gitignore.
Packaging
- Package auto-discovery. Added
extra.laravel.providerstocomposer.json. You no longer need to manually addMSG4wrdIOServiceProvider::classtoconfig/app.php. - Explicit constraints.
composer.jsonnow declaresphp: ^8.1andilluminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0, so Composer can resolve the right Laravel version on install. - Switched
minimum-stabilitytostablewithprefer-stable: true.
Upgrading
Upgrading to Laravel 13? Just update the package — no app changes needed:
If you are upgrading from a much earlier version:
- Remove the manual
KPAPH\MSG4wrdIO\MSG4wrdIOServiceProvider::classentry fromconfig/app.php— auto-discovery handles it now. - If you relied on the
/msg4wrd*demo routes, addMSG4wrdIO_EXPOSE_DEMO_ROUTES=trueto your.env(recommended: local environments only). - Re-publish the config:
php artisan vendor:publish --tag=msg4wrdio-config --force. - If you called
MSG4wrd::chechNumberCountryCode(...)directly, rename it tocheckNumberCountryCode.
All versions of msg4wrdio with dependencies
guzzlehttp/guzzle Version ^6.3|^7.2|^8.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0|^13.0