Integrate with Dub using PHP

Integrate Dub's link management infrastructure in your PHP application with just a few lines of code.

Dub has helped us gain valuable insights into the link-sharing use case of Ray.so. And all of it with just a few lines of code – thanks to their native SDKs.

Thomas Paul MannThomas Paul MannCEO & Co-Founder, Raycast

Quick Start

Integrate advanced link management capabilities into your projects by checking out the documentation and installing with your preferred package manager.

composer require dub/dub-php

Integrate your project seamlessly

With the Dub PHP SDK, you can programmatically generate short links in just a few lines of code.

use Dub;
use DubModelsComponents;
use DubModelsOperations;

$security = new ComponentsSecurity();
$security->token = 'DUB_API_KEY';

$dub = Dub::builder()->setSecurity($security->token)->build();
    

Explore API Endpoints

Links
Domains
Tags
More
+ 4 methods
Request
$response = $dub->links->create([
    'url' => 'https://google.com',
]);
Response
{
  id: "clv3o9p9q000au1h0mc7r6l63",
  domain: "dub.sh",
  key: "e7qzMuI",
  url: "https://www.google.com",
  ...
}

Dub's API allowed us to programmatically shorten URLs with a single API call, making it easier for our community to share insights into open source.

Brandon RobertsBrandon RobertsEngineering Lead, Opensauced

All you need to get started

Check out our resources to harness the full potential of the Dub PHP SDK.

Quickstart Guide

Learn how to create a short link with the Dub PHP SDK.

Examples

See example apps that you can build with the Dub PHP SDK.

API Reference

Learn about Dub's REST API and its features.

Supercharge
your marketing efforts

See why Dub.co is the link management infrastructure of choice for modern marketing teams.