Overview
Discover what makes Shlink powerful
Shlink is a fully self‑hosted URL shortener written in PHP 8.3/8.4 that exposes a rich REST API, a PWA dashboard and a CLI interface for managing links. The core engine is built on the Symfony framework, leveraging its HTTP kernel, routing and dependency injection container. This gives developers a familiar structure for extending or replacing components while keeping the application lightweight enough to run in LAMP stacks, Docker containers, or even serverless PHP runtimes.
Language & Framework
Database
Extensions
Containerization
Overview
Shlink is a fully self‑hosted URL shortener written in PHP 8.3/8.4 that exposes a rich REST API, a PWA dashboard and a CLI interface for managing links. The core engine is built on the Symfony framework, leveraging its HTTP kernel, routing and dependency injection container. This gives developers a familiar structure for extending or replacing components while keeping the application lightweight enough to run in LAMP stacks, Docker containers, or even serverless PHP runtimes.
Technical Stack & Architecture
- Language & Framework: PHP 8.3/8.4 + Symfony 6.x, using Doctrine ORM for persistence and Symfony Messenger for asynchronous tasks.
- Database: Supports MySQL, MariaDB, PostgreSQL, Microsoft SQL Server and SQLite via PDO drivers; schema migrations are handled with Doctrine Migrations.
- Extensions: Requires common PHP extensions (json, curl, pdo, intl, gd, gmp/bcmath). Optional extensions include
apcufor caching,xmlfor SVG QR generation andsockets/bcmathfor RabbitMQ integration. - Containerization: Official Docker image is available on Docker Hub; the image uses a multi‑stage build, exposing only necessary ports and allowing environment variables for configuration. The container can be orchestrated with Docker Compose, Kubernetes, or any OCI‑compatible platform.
- API First: All CRUD operations for links, domains and statistics are exposed via a JSON‑based REST API. Authentication is token‑based (JWT or simple bearer tokens) and can be configured per instance.
Core Capabilities
- Link Management: Create, update, delete short links with optional custom slugs; set expiration dates and redirect rules.
- Domain Handling: Register multiple hostnames, configure custom SSL/TLS certificates and enforce domain‑level policies.
- Analytics: Store visit events with IP, user agent, referrer and geolocation (via MaxMind GeoIP). Expose aggregated statistics via API endpoints.
- QR Code Generation: Dynamically generate QR codes for links in PNG or SVG format using the GD extension.
- Webhook Support: Emit events on link creation, deletion or visit for downstream processing (e.g., analytics dashboards).
- CLI Tool: Symfony Console commands enable bulk link creation, export/import of data, and health checks without exposing the API.
Deployment & Infrastructure
Shlink is designed for self‑hosting scenarios where data sovereignty and custom domain control are paramount. It runs on any web server that can execute PHP (Apache, Nginx, FastCGI). For high‑availability setups:
- Stateless Service: The application itself is stateless; only the database and optional message broker (RabbitMQ) hold state.
- Horizontal Scaling: Multiple instances can be run behind a load balancer; Doctrine’s caching layer (APCu or Redis) ensures consistent ID generation.
- CI/CD Friendly: The project ships with GitHub Actions for continuous integration, code coverage reports, and automated Docker image builds.
Integration & Extensibility
- Plugins: The architecture supports a plugin system where developers can register custom link generators, analytics collectors or authentication providers via Symfony services.
- Webhooks & Callbacks: External systems can subscribe to events; Shlink supports HTTP callbacks with configurable payloads.
- Custom Domains & CNAMEs: Developers can programmatically add domains via the API, enabling multi‑tenant deployments.
- SDKs: While not bundled, community SDKs in PHP, JavaScript and Python simplify integration into existing applications.
Developer Experience
- Documentation: The official docs are comprehensive, with sections for API reference, CLI usage and Docker deployment. Interactive examples demonstrate common workflows.
- Community & Support: Active GitHub repository, Slack/Discord channels, and a public issue tracker provide quick assistance. The project is MIT licensed, allowing unrestricted commercial use.
- Configuration: Most settings are exposed via environment variables or a
.envfile, making it straightforward to integrate into CI/CD pipelines.
Use Cases
- Marketing Campaigns: Generate branded short links, track click‑through rates and embed QR codes in print media.
- Internal Tooling: Provide a self‑hosted link shortener for corporate intranets, ensuring URLs stay under company control.
- Analytics‑First Projects: Leverage the built‑in visit tracking and GeoIP data to feed dashboards or trigger serverless functions on high traffic.
- Multi‑Tenant SaaS: Deploy a Shlink instance per customer, each with its own domain and analytics, using the plugin system to enforce tenant isolation.
Advantages Over Alternatives
- Open Source & Self‑Hosted: No reliance on third‑party services; full control over data and privacy.
- Performance & Scalability: Symfony’s HTTP kernel and Doctrine’s efficient queries keep latency low; optional Redis/APCu caching boosts throughput.
- Extensibility: Plug‑in architecture and a well‑defined API make it easy to add custom business logic or integrate with existing systems.
- License Freedom: MIT license allows use in proprietary products without attribution or revenue sharing.
Shlink delivers a robust, developer‑friendly URL shortener that balances ease of deployment with deep customization options—ideal for teams that need a self‑hosted, analytics‑rich solution.
Open SourceReady to get started?
Join the community and start self-hosting Shlink today
Related Apps in apis-services
Mastodon
Decentralized, real‑time social networking
Discourse
Open‑source community forum platform with real‑time chat and AI
Rocket.Chat
Secure, open‑source team communication platform
Novu
Unified notification platform for multi‑channel delivery
Mattermost
Secure, self‑hosted team collaboration with chat, voice, and AI
Jitsi Meet
Free, encrypted video conferencing for everyone
Weekly Views
Repository Health
Information
Explore More Apps
Gameyfin
Your personal game library manager
Taskwarrior
Command‑line task manager for organized, efficient to-do lists
Vanilla Cookbook
Simplify recipe management with smart conversion and AI assistance
AnonAddy
Anonymous email forwarding with custom aliases for privacy.
Umbraco
Open, scalable CMS empowering enterprises with speed and flexibility
Hi.Events
Sell tickets, manage events, and grow audiences all in one
