{"id":18932852,"url":"https://github.com/hpatoio/bitly-api","last_synced_at":"2025-10-24T14:20:24.648Z","repository":{"id":56986215,"uuid":"14234255","full_name":"hpatoio/bitly-api","owner":"hpatoio","description":"PHP Library based on Guzzle to consume Bit.ly API","archived":false,"fork":false,"pushed_at":"2019-12-17T10:47:07.000Z","size":65,"stargazers_count":33,"open_issues_count":0,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-15T03:53:19.043Z","etag":null,"topics":["behat","bitly","guzzle","php","php-library"],"latest_commit_sha":null,"homepage":null,"language":"Gherkin","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hpatoio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-08T13:57:50.000Z","updated_at":"2022-01-05T11:27:33.000Z","dependencies_parsed_at":"2022-08-21T09:00:06.698Z","dependency_job_id":null,"html_url":"https://github.com/hpatoio/bitly-api","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpatoio%2Fbitly-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpatoio%2Fbitly-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpatoio%2Fbitly-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpatoio%2Fbitly-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hpatoio","download_url":"https://codeload.github.com/hpatoio/bitly-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003955,"owners_count":21196794,"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":["behat","bitly","guzzle","php","php-library"],"created_at":"2024-11-08T11:50:48.966Z","updated_at":"2025-10-24T14:20:24.576Z","avatar_url":"https://github.com/hpatoio.png","language":"Gherkin","readme":"# BitlyApi \n\n## This package is not maintained\nCheck [phplicengine/bitly](https://packagist.org/packages/phplicengine/bitly) as a possible replacement.\n\n[![Build Status](https://travis-ci.org/hpatoio/bitly-api.svg?branch=master)](https://travis-ci.org/hpatoio/bitly-api)\n[![Total Downloads](https://poser.pugx.org/hpatoio/bitly-api/downloads.png)](https://packagist.org/packages/hpatoio/bitly-api)\n[![Latest Stable Version](https://poser.pugx.org/hpatoio/bitly-api/v/stable.png)](https://packagist.org/packages/hpatoio/bitly-api)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/8d861d8b-3529-493d-b801-1a11a098492e/mini.png)](https://insight.sensiolabs.com/projects/8d861d8b-3529-493d-b801-1a11a098492e)\n\nPHP Library based on Guzzle to consume Bit.ly API.\n\nThe biggest advantage in using Guzzle is that you can easely attach [Guzzle plugins](http://guzzle.readthedocs.org/en/latest/plugins/plugins-overview.html) to your client. [Here](#attach-guzzle-plugin), for example,you can see how to attach the log plugin and write all your requests to a file.\n\nAn [integration](#integrations) with Symfony2 is available as well.\n\n## Versions\n\n* branch `master` follows _psr4_ standards and get `2.x` tags\n* branch `psr0` follows, of course, _psr0_ standards and get `1.x` tags - No new features only bugfix\n\nThis project follow [semantic versioning](http://semver.org/). \n\n## Installation\n\nThe recommended way to install this library is through Composer.\nFor information about Composer and how to install in [look here](http://getcomposer.org/doc/00-intro.md).\n\n#### New project \n\nFrom the command line run \n\n```shell\n./composer create-project hpatoio/bitly-api your_prj_dir '~2.0'\n```\n\n#### Existing project\n\nMove into your project directory and run\n\n```shell\n./composer require hpatoio/bitly-api '~2.0'\n```\nor add to your `composer.json`\n```json\n{\n    ...\n    \"require\": {\n        ...\n        \"hpatoio/bitly-api\": \"~2.0\"\n    }\n}\n```\nand run \n```shell\n./composer update\n```\n\n## Usage\n```php\n\u003c?php\n\n// This file is generated by Composer\nrequire_once 'vendor/autoload.php';\n\n# To find your bitly access token see here https://bitly.com/a/oauth_apps\n$my_bitly = new \\Hpatoio\\Bitly\\Client(\"insert_here_your_bitly_api_access_token\");\n\n$response = $my_bitly-\u003eHighvalue(array(\"limit\" =\u003e 3));\n\nprint_r($response);\n\n```\n## cURL options\n\nIt might be that bit.ly is unreachable and you want to set a specific timeout.\nJust set the cURL timeout options in the client:\n\n```php\n\n$my_bitly = new \\Hpatoio\\Bitly\\Client(\"insert_here_your_bitly_api_access_token\");\n// set cURL timeout, you can specify any cURL options\n$my_bitly-\u003esetConfig(array(\n    'curl.options' =\u003e \n        array(\n            CURLOPT_TIMEOUT =\u003e 2, \n            CURLOPT_CONNECTTIMEOUT =\u003e 2\n        )\n    ));\n\n$response = $my_bitly-\u003eHighvalue(array(\"limit\" =\u003e 3));\n\nprint_r($response);\n\n```\n\n\n## Methods names\n\nTo get the method name remove \"v3\" from the API url and camelize the other words removing the slashes.\n\nExamples:\n\n* /v3/highvalue -\u003e Highvalue\n* /v3/realtime/hot_phrases -\u003e RealtimeHot_phrases\n* /v3/link/content -\u003e LinkContent\n\n## Available methods\nAt the moment the library supports these APIs:\n\n- [bitly Data APIs](http://dev.bitly.com/data_apis.html)\n- [Links](http://dev.bitly.com/links.html)\n- [Link Metrics](dev.bitly.com/link_metrics.html)\n- [User Metrics](http://dev.bitly.com/user_metrics.html)\n\n## [Behat](http://behat.org)\nYou need to copy Behat default configuration file and enter your ``access_token`` option there.\n```bash\n$ cp behat.yml.dist behat.yml\n```\nNow open `behat.yml` and change the string `your_bitly_access_token_here` with your access token.\nRun the suite typing\n```bash\n$ bin/behat\n```\n\n## Integrations\nA Symfony2 bundle that integrate this library is available [here](https://github.com/hpatoio/BitlyBundle)\n\n## Attach Guzzle plugin\n\nHere you can see how to attach Guzzle Log plug to your client and save all your requests to a file.\n\n*NB:* To run this script you need `monolog/monolog`\n\n```php\n\u003c?php\n// This file is generated by Composer\nrequire_once 'vendor/autoload.php';\n\nuse Guzzle\\Log\\MessageFormatter;\nuse Guzzle\\Log\\MonologLogAdapter;\nuse Guzzle\\Plugin\\Log\\LogPlugin;\nuse Monolog\\Handler\\StreamHandler;\nuse Monolog\\Logger;\n\n$logger = new Logger('client');\n$logger-\u003epushHandler(new StreamHandler('/tmp/bitly_guzzle.log'));\n$adapter = new MonologLogAdapter($logger);\n$logPlugin = new LogPlugin($adapter, MessageFormatter::DEBUG_FORMAT);\n\n# To find your bitly access token see here https://bitly.com/a/oauth_apps\n$my_bitly = new \\Hpatoio\\Bitly\\Client(\"your_bitly_access_token\");\n$my_bitly-\u003eaddSubscriber($logPlugin);\n\n$response = $my_bitly-\u003eHighvalue(array(\"limit\" =\u003e 3));\n\nprint_r($response);\n```\n\nNow in `/tmp/bitly_guzzle.log` you can see all your requests.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpatoio%2Fbitly-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhpatoio%2Fbitly-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpatoio%2Fbitly-api/lists"}