yeamin/bitly-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yeamin/bitly-laravel

Composer 安装命令:

composer require yeamin/bitly-laravel

包简介

A laravel package to maintain bitly api, to short link, get full link, description, status and other features offered by bitly.

README 文档

README

A simple package to use bitly api effectively to short link, get full link and other features offered by bitly.

For more information see Bitly

Requirements

Laravel 5.1 or later, minimum php version 7.0

Installation

Installation is a quick 3 step process:

  1. Download bitly-laravel using composer
  2. Enable the package in app.php
  3. Configure your Bitly credentials

Use the different methods offered in this package to access different bitly services.

Step 1: Download laravel-bitly using composer

Add yeamin/bitly-laravel package for laravel by running the command:

composer require yeamin/bitly-laravel

Step 2: Enable the package in app.php

Register the Service in: config/app.php. Add the below line inside providers array. One can find the provide array inside config/app.php

Yeamin\Bitly\BitlyServiceProvider::class,

Register the Bitly Facade in: config/app.php Add the below line inside aliases array.

'Bitly' => Yeamin\Bitly\Facade\Bitly::class,

This is a example where the Bitly facades will be added.

'aliases' => [

        'App' => Illuminate\Support\Facades\App::class,
        'Artisan' => Illuminate\Support\Facades\Artisan::class,
        'Auth' => Illuminate\Support\Facades\Auth::class,
        ...
        'Bitly' => Yeamin\Bitly\Facade\Bitly::class,

Step 3: Configure Bitly credentials

Run the following command.

php artisan vendor:publish --provider="Yeamin\Bitly\BitlyServiceProvider"

Add this in you .env file. One will need generic access token and enter the token in the place of your_secret_bitly_access_token inside .env You can find the generic access token from here Bitly Access Token.

BITLY_ACCESS_TOKEN=your_secret_bitly_access_token

Usage

To Get short URL:

( Do not forget to give http or https in the beginning of your url )

$url = app('bitly')->getShortUrl('https://www.google.com/'); // http://bit.ly/nHcn3

Or if you want to use facade, add this in your class after namespace declaration:

use Bitly;

Then you can use it directly by calling Bitly:: like:

$url = Bitly::getShortUrl('https://www.google.com/'); // http://bit.ly/nHcn3

To Expand URL:

$shortUrl = app('bitly')->getLongUrl('http://bit.ly/nHcn3'); // https://www.google.com/

Or if you want to use facade, add this in your class after namespace declaration:

use Bitly;

Then you can use it directly by calling Bitly:: like:

$url = Bitly::getLongUrl('http://bit.ly/nHcn3'); // https://www.google.com/

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固