{"id":15026101,"url":"https://github.com/phplicengine/bitly","last_synced_at":"2025-07-29T17:06:21.438Z","repository":{"id":53052386,"uuid":"218585292","full_name":"phplicengine/bitly","owner":"phplicengine","description":"Bitly v4 API","archived":false,"fork":false,"pushed_at":"2023-02-16T11:50:28.000Z","size":311,"stargazers_count":21,"open_issues_count":0,"forks_count":81,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T02:31:22.682Z","etag":null,"topics":["api","api-client","api-rest","api-server","api-service","bitlinks","bitly","bitly-api","bitly-client","bitly-v4","link-shortener","php","php7","php72","shorten-urls","shortener","shortens-links","shorturl","url-shortener","urlshortener"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phplicengine.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}},"created_at":"2019-10-30T17:32:50.000Z","updated_at":"2024-07-14T17:03:06.000Z","dependencies_parsed_at":"2023-11-18T00:13:19.998Z","dependency_job_id":"2f48ca73-d363-401c-ac30-0cba9d2be8e9","html_url":"https://github.com/phplicengine/bitly","commit_stats":{"total_commits":337,"total_committers":2,"mean_commits":168.5,"dds":0.06528189910979232,"last_synced_commit":"715c141645ece5c13f617838556c279852d848a6"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/phplicengine/bitly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplicengine%2Fbitly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplicengine%2Fbitly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplicengine%2Fbitly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplicengine%2Fbitly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phplicengine","download_url":"https://codeload.github.com/phplicengine/bitly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phplicengine%2Fbitly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267721977,"owners_count":24133839,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","api-client","api-rest","api-server","api-service","bitlinks","bitly","bitly-api","bitly-client","bitly-v4","link-shortener","php","php7","php72","shorten-urls","shortener","shortens-links","shorturl","url-shortener","urlshortener"],"created_at":"2024-09-24T20:03:45.166Z","updated_at":"2025-07-29T17:06:21.381Z","avatar_url":"https://github.com/phplicengine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://app.travis-ci.com/phplicengine/bitly.svg?branch=master)](https://app.travis-ci.com/phplicengine/bitly)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/phplicengine/bitly/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phplicengine/bitly/?branch=master)\n[![Latest Stable Version](https://img.shields.io/packagist/v/phplicengine/bitly?label=version)](https://packagist.org/packages/phplicengine/bitly)\n[![Total Downloads](https://img.shields.io/packagist/dt/phplicengine/bitly?color=blue)](https://packagist.org/packages/phplicengine/bitly)\n[![Release date](https://img.shields.io/github/release-date/phplicengine/bitly)](https://packagist.org/packages/phplicengine/bitly)\n[![php](https://img.shields.io/packagist/php-v/phplicengine/bitly)](https://packagist.org/packages/phplicengine/bitly)\n[![License](https://img.shields.io/packagist/l/phplicengine/bitly)](https://packagist.org/packages/phplicengine/bitly)\n\n\n\n# Bitly API v4\n\n## Contents\n* [Installation](#installation)\n* [Usage](#usage)\n* [Manual](#manual)\n* [Contributing and Support](#contributing-and-support)\n* [License](#license)\n\n## Installation\n```\ncomposer require phplicengine/bitly\n```\n\n## Usage\n```php\nuse PHPLicengine\\Api\\Api;\nuse PHPLicengine\\Service\\Bitlink;\n\n$api = new Api(\"API KEY GOES HERE\");\n$bitlink = new Bitlink($api);\n$result = $bitlink-\u003ecreateBitlink(['long_url' =\u003e 'http://www.example.com']);\n\n// if cURL error occurs.\nif ($api-\u003eisCurlError()) {\n    \n    print($api-\u003egetCurlErrno().': '.$api-\u003egetCurlError());\n    \n} else {\n\n    // if Bitly response contains error message.\n    if ($result-\u003eisError()) {\n\n        print(\"Error:\u003cbr /\u003e\");\n        print($result-\u003egetResponse());\n        print($result-\u003egetDescription());\n    \n    } else {\n    \n        // if Bitly response is 200 or 201\n        if ($result-\u003eisSuccess()) {\n        \n            print(\"SUCCESS:\u003cbr /\u003e\");\n            print($result-\u003egetResponse());\n            print_r($result-\u003egetResponseArray());\n\n        } else {\n\n            print(\"FAIL:\u003cbr /\u003e\");\n            print($result-\u003egetResponse());\n            print_r($result-\u003egetResponseArray());\n\n        }\n    }\n}\n\n// for debug only.\nprint(\"INFO:\u003cbr /\u003e\");\n\n// returns response exactly as it is. e.g. json.\n$resj = $result-\u003egetResponse();\nprint($resj.\"\u003cbr /\u003e\");\n\n// returns decoded json.\n$reso = $result-\u003egetResponseObject();\nprint_r($reso);\n\n// returns header of server.\n$resh = $result-\u003egetHeaders();\nprint_r($resh);\n\n// returns request.\n$resr = $api-\u003egetRequest();\nprint_r($resr);\n```\n\n## Manual\n\n#### Service Classes\n\nIn [Bitly API v4](https://dev.bitly.com/api-reference) documentations, resources are classified under serveral categories:\n\nBitlink, Group, Organization, User, Custom, Campaign, Bsd, OAuth, Auth, Webhook\n\nWe made each of them as a separate service class. Method names are the same as the last part of documentation url.\nFor example if you want to use [Get Metrics for a Bitlink by Country](https://dev.bitly.com/api-reference#getMetricsForBitlinkByCountries), this one is classified under Bitlink category in documentation and the last part of its url is `getMetricsForBitlinkByCountries`, so you can call it this way:\n\n```php\nuse PHPLicengine\\Api\\Api;\nuse PHPLicengine\\Service\\Bitlink;\n\n$api = new Api(\"API KEY GOES HERE\");\n$bitlink = new Bitlink($api);\n$result = $bitlink-\u003egetMetricsForBitlinkByCountries('bit.ly/34nRNvl', ['unit' =\u003e 'day', 'units' =\u003e -1]);\n```\n\nAll Path parameters, must be passed as string in first argument of methods if necessary and all Query parameters must be passed as array in second argument of methods if necessary. If Path parameter is not needed, Query parameters will be first argument of methods.\n\nAnother example:\n\n[Retrieve Group Shorten Counts](https://dev.bitly.com/api-reference#getGroupShortenCounts) is classified under Group category, and the last part of its link is `getGroupShortenCounts`, so you can call it this way:\n\n```php\nuse PHPLicengine\\Api\\Api;\nuse PHPLicengine\\Service\\Group;\n\n$api = new Api(\"API KEY GOES HERE\");\n$group = new Group($api);\n$result = $group-\u003egetGroupShortenCounts($group_guid);\n```\n\nHere is [list of available service classes and methods](Services.md).\n\n#### Custom cURL Options\n\nBy default cURL timeout is 30. You can change it with:\n```php\n$api-\u003esetTimeout(30);\n```\n\nIf you need to add some CURLOPT_* constants that are not enabled by default, you can call setCurlCallback() method to add them.\n\n```php\nuse PHPLicengine\\Api\\Api;\nuse PHPLicengine\\Service\\Bitlink;\n\n$api = new Api(\"API KEY GOES HERE\");\n$api-\u003esetCurlCallback(function($ch, $params, $headers, $method) { \n      curl_setopt($ch, CURLOPT_*, 'some value'); \n}); \n$bitlink = new Bitlink($api);\n```\nThis is added for your convenience, but you should not need it.\n\n## Contributing and Support\nFor all issues or feature request or support questions please open a new [issue](https://github.com/phplicengine/bitly/issues). All pull requests are welcome.\n\n## License\nPHPLicengine Api is distributed under the Apache License. See [License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphplicengine%2Fbitly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphplicengine%2Fbitly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphplicengine%2Fbitly/lists"}