Short URL PHP Generate Firebase,In this example we will discuss how to make a URL short from a long URL using firebase, In this example, I just posted a PHP function, I made a shorten_URL() PHP function, and this function will return a short URL from the firebase server. First, you need to set up this function properly in your application, therefor first you must require your firebase account API key.
For Firebase Dynamic Links Shorten URL PHP, We must require a firebase API key, open your firebase google account and generate your API key, for getting a firebase API key you need to register your domain name and domina page and other additional details. after entering all the details you will get the API key from there.
To generate a short URL from a firebase account paste your API key in this function. Then after entering your prefix your domain name is in the function. then after putting your android info package name and ios bundled id in the function.
To get a Short URL from this PHP function using firebase, You are required to pass an argument in this function, The argument is a LONG URL. pass long URL in the function, This function will return a SHORT URL from the firebase server.
function shorten_URL($longUrl) {
return Curl::to('https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key={FIREBASE API KEY}')
->withHeader('Content-Type: application/json')
->withData([
'dynamicLinkInfo' => [
'domainUriPrefix' => 'https://example.page.link',
'link' => $longUrl,
'androidInfo' => [
'androidPackageName' => 'com.example'
],
'iosInfo' => [
'iosBundleId' => 'com.example'
]
],
'suffix' => [
"option" => "SHORT"
],
])
->asJson(true)
->post();
}
Get IP PHP Function Example - ip_info()
Slug PHP Function Example - slugify($string)
How To Check Given URL Is Valid Or Not PHP Function Example
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel JSON Data Search/Filter From Database Example
- could not find driver (SQL: select count(*) as aggregate from "users" where "email" = admin@gmail.com)
- How to connect database with php
- Microsoft Authentication Implement on Laravel App
- HTTP Client Guzzle Package With Basic Usage In Laravel
- Laravel 10 Restful API Passport Authentication Tutorial
- Laravel 12 React Authentication Tutorial (Login & Register with Sanctum 2026)
- Laravel 10 Breeze Integration Tutorial Example
- Laravel 12 AJAX CRUD Tutorial (No Page Reload Step-by-Step Guide 2026)
- Laravel 56 Login and Logout