Telesink is built in Ruby on Rails, so
Ruby came first,
JavaScript came next, and now
PHP is here. The official
telesink/telesink package
brings Telesink events to any PHP application.
I kept it dependency-free. It only uses built-in curl and
random_bytes. Install it, set one environment variable, and
send an event.
Configuration
The SDK is configured entirely through environment variables. No classes to instantiate, no config files, no YAML.
Set your sink endpoint:
export TELESINK_ENDPOINT=https://app.telesink.com/api/v1/sinks/your_sink_token_here/events
For self-hosted instances, just change the URL to point at your own server.
To disable tracking (for example in tests or local development):
export TELESINK_DISABLED=true
Usage
use Telesink\Telesink as Telesink;
Telesink::track([
'event' => 'User signed up',
'text' => '[email protected]',
'emoji' => '👤',
'properties' => [
'plan' => 'pro',
'source' => 'landing_page',
'user_id' => 123,
'email' => '[email protected]'
],
// occurred_at and idempotency_key are optional (defaults are provided)
]);
The method returns true if the event was sent successfully and
false otherwise (disabled, missing endpoint, or network error).
It will never raise exceptions. Errors are logged with
error_log(), and the call fails quietly.
What’s under the hood
The entire package is ~80 lines of plain PHP. It:
- adds an
Idempotency-Keyheader automatically - tags every payload with
sdk: { name: "telesink.php", version: "1.0.0" } - times out after 3 seconds
- works identically with the hosted version and any self-hosted instance
Next steps
Ruby, JavaScript, and PHP are done. Python, Go, and more are next. Let me know on X which one you want first.
Other official Telesink SDKs
The complete source is at github.com/telesink/telesink-php. It is MIT licensed.
Now go connect your PHP app. Laravel, Symfony, WordPress, plain old PHP, it does not matter. The event should appear in your Telesink feed right away.
Follow along on X at @kyrylo.