Create Firebase Dynamic Links from Php and Laravel
composer require "yedincisenol/dynamic-links"
$dynamicLink = new yedincisenol\DynamicLinks\DynamicLinks([
'api_key' => 'apiKeyFromFirebaseProject',
'dynamic_link_domain' => 'dynami-domain-from-dynamic-links.goo.gl
]);
- Add composer
composer require "yedincisenol/dynamic-links"
- Add service provider (For Laravel 5.6 before)
config/app.php
'providers' => [
yedincisenol\DynamicLinks\LaravelServiceProvider::class
],
- Fill Environments
copy theese parameters to your project .env and fill
FIREBASE_API_KEY=
FIREBASE_DYNAMIC_LINKS_DOMAIN=
- Laravel Usage
$link = new yedincisenol\DynamicLinks\DynamicLink('http://yeni.co/');
$shortLink = $dynamicLink->create($link, 'UNGUESSABLE');
- Publish Config file Publish Config for Laravel
php artisan vendor:publish --tag=dynamic-links
$dynamicLink = new yedincisenol\DynamicLinks\DynamicLinks([
'api_key' => $apiKey,
'dynamic_link_domain' => $dynamicLinkDomain
]);
$link = new yedincisenol\DynamicLinks\DynamicLink('http://yeni.co/');
$shortLink = $dynamicLink->create($link, 'UNGUESSABLE');
Advanced usage: example.php
Run
phpunit