{"id":16233556,"url":"https://github.com/shivella/laravel-bitly","last_synced_at":"2025-04-05T09:10:15.851Z","repository":{"id":47523044,"uuid":"76893124","full_name":"Shivella/laravel-bitly","owner":"Shivella","description":"Laravel package for generating bitly url","archived":false,"fork":false,"pushed_at":"2024-06-21T19:13:13.000Z","size":93,"stargazers_count":74,"open_issues_count":1,"forks_count":27,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T13:12:53.947Z","etag":null,"topics":["bitly","laravel","laravel-bitly","php","url-shortener"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shivella.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-19T20:00:41.000Z","updated_at":"2024-02-29T08:29:53.000Z","dependencies_parsed_at":"2023-11-07T02:13:36.090Z","dependency_job_id":"dca7d184-c0e8-436d-9210-a38f0eeb58e1","html_url":"https://github.com/Shivella/laravel-bitly","commit_stats":{"total_commits":88,"total_committers":14,"mean_commits":6.285714285714286,"dds":"0.46590909090909094","last_synced_commit":"dd86ca95edbfd193d6d0b2151cc124b4df5fb844"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shivella%2Flaravel-bitly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shivella%2Flaravel-bitly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shivella%2Flaravel-bitly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shivella%2Flaravel-bitly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shivella","download_url":"https://codeload.github.com/Shivella/laravel-bitly/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312085,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitly","laravel","laravel-bitly","php","url-shortener"],"created_at":"2024-10-10T13:13:03.735Z","updated_at":"2025-04-05T09:10:15.810Z","avatar_url":"https://github.com/Shivella.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Laravel Bitly Package\n=====================\n\nA laravel package for generating Bitly short URLs.\n\nFor more information see [Bitly](https://bitly.com/)\n\n[![Build Status](https://github.com/Shivella/laravel-bitly/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/Shivella/laravel-bitly/actions) [![Latest Stable Version](https://poser.pugx.org/shivella/laravel-bitly/v/stable)](https://packagist.org/packages/shivella/laravel-bitly) [![License](https://poser.pugx.org/shivella/laravel-bitly/license)](https://packagist.org/packages/shivella/laravel-bitly) [![Total Downloads](https://poser.pugx.org/shivella/laravel-bitly/downloads)](https://packagist.org/packages/shivella/laravel-bitly)\n\n## Requirements ##\n\nLaravel 5.1 or later\n\n\nInstallation\n------------\nInstallation is a quick 3 step process:\n\n1. Download laravel-bitly using composer\n2. Enable the package in app.php\n3. Configure your Bitly credentials\n4. (Optional) Configure the package facade\n\n### Step 1: Download laravel-bitly using composer\n\nAdd shivella/laravel-bitly by running the command:\n\n```\ncomposer require shivella/laravel-bitly\n```\n\n### Step 2: Enable the package in app.php\n\nRegister the Service in: **config/app.php**\n\n``` php\nShivella\\Bitly\\BitlyServiceProvider::class,\n````\n\n### Step 3: Configure Bitly credentials\n\n```\nphp artisan vendor:publish --provider=\"Shivella\\Bitly\\BitlyServiceProvider\"\n```\n\nAdd this in you **.env** file\n\n```\nBITLY_ACCESS_TOKEN=your_secret_bitly_access_token\n```\n\n### Step 4 (Optional): Configure the package facade\n\nRegister the Bitly Facade in: **config/app.php**\n\n```php\n\u003c?php\n\nreturn [\n    'aliases' =\u003e [\n\n        'App' =\u003e Illuminate\\Support\\Facades\\App::class,\n        'Artisan' =\u003e Illuminate\\Support\\Facades\\Artisan::class,\n        'Auth' =\u003e Illuminate\\Support\\Facades\\Auth::class,\n        // ...\n        'Bitly' =\u003e Shivella\\Bitly\\Facade\\Bitly::class,\n    ],\n    // ...\n];\n````\n\nUsage\n-----\n\n```php\n\u003c?php\n\n$url = app('bitly')-\u003egetUrl('https://www.google.com/'); // http://bit.ly/nHcn3\n````\n\nOr if you want to use facade, add this in your class after namespace declaration:\n\n```php\n\u003c?php\n\nuse Bitly;\n```\n\nThen you can use it directly by calling `Bitly::` like:\n\n```php\n\u003c?php\n\n$url = Bitly::getUrl('https://www.google.com/'); // http://bit.ly/nHcn3\n````\n\n### Testing\n\nIn your unit tests you may use `BitlyClientFake` class instead of regular client.\nIt will create a fake short URLs using hashing without calling an external REST API, which will speed up your unit tests.\nFake might be setup via DI at your `\\Tests\\TestCase::createApplication()` implementation:\n\n```php\n\u003c?php\n\nnamespace Tests;\n\nuse Illuminate\\Contracts\\Console\\Kernel;\nuse Shivella\\Bitly\\Testing\\BitlyClientFake;\n\ntrait CreatesApplication\n{\n    /**\n     * Creates the application.\n     *\n     * @return \\Illuminate\\Foundation\\Application\n     */\n    public function createApplication()\n    {\n        $app = require __DIR__.'/../bootstrap/app.php';\n\n        $app-\u003emake(Kernel::class)-\u003ebootstrap();\n\n        // swap Bitly client by a fake\n        $app-\u003esingleton('bitly', function () {\n            return new BitlyClientFake();\n        });\n\n        return $app;\n    }\n}\n```\n\nAs an alternative you may use `\\Shivella\\Bitly\\Facade\\Bitly::fake()` method to swap regular client by a fake.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivella%2Flaravel-bitly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivella%2Flaravel-bitly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivella%2Flaravel-bitly/lists"}