承接 artoodetoo/urly 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

artoodetoo/urly

Composer 安装命令:

composer require artoodetoo/urly

包简介

Minimum viable URL shortener class

README 文档

README

Do you want to encode URLs like tinyurl.com does?
This is helper tool for you.

Features

Urly uses PDO interface to store URLs. Just refer to your existing connection.

Optionally you can specify table name, key encode base and XOR mask.

Access methods are quite obvious: set($url) and get($key).

Install

To install with composer:

composer require artoodetoo/urly

Required table structure:

CREATE TABLE `urly` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `url` varchar(1000) NOT NULL,
  PRIMARY KEY (`id`)
)

Basic Usage

Save URL and het encoded key:

$db = new \PDO(
    'mysql:dbname=homestead;host=127.0.0.1;charset=utf8',
    'homestead', 
    'secret'
);

// Set 62 base to get alfa-numeric key in both cases and 
// some magic number to make key sequence be less predictable
$shortener = new \R2\Utility\Urly($db, 'my_urly', 62, 990749);

$key = $shortener->set('http://localhost/test.txt');
echo 'http://go.to/'.$key."\n"; // Something like 'http://go.to/49Jz'

Get URL by key:

echo $shortener->get('49Jz'); // Saved URL or empty string if not found

License

The Urly is open-source software, licensed under the MIT license

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-12-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固