elliottlan/laravel-baser 问题修复 & 功能扩展

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

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

elliottlan/laravel-baser

最新稳定版本:1.1

Composer 安装命令:

composer require elliottlan/laravel-baser

包简介

Encode and decode integers with your own specified base!

README 文档

README

Base encode and decode integers with your own specified base

View the package at packagist.org

Requirements

  • Laravel
  • PHP

Limits

  • Currently only supports integers from 1 to 100000000000000000000000000000 (on 64 bit machines)

Installation

  1. Include the composer package
composer require elliottlan/laravel-baser
  1. Add this line to 'Providers' in config/app.php
Elliottlan\LaravelBaser\LaravelBaserServiceProvider::class,
  1. Add this line to 'Aliases' in config/app.php
'Baser' => Elliottlan\LaravelBaser\Facades\Baser::class,
  1. Use 'Base' at the top of a controller
use Baser;
  1. Try an example out
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA

Usage examples

Encode an int
echo Baser::getTokenFromInt(436432278698); // 7GnTmBA
Decode a token
echo Baser::getIntFromToken('7GnTmBA'); // 436432278698
Use big maths (requires php-bcmath)
// calculate above the 32bit limit on old machines
echo Baser::bcMath()->getTokenFromInt(19598531548); // lolrly
echo Baser::bcMath()->getIntFromToken('lolrly'); // 19598531548
Define a codeset and encode/decode
// set codeset to 'ABCEFGHKMNPRSTUVW1235789'
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getTokenFromInt(646464); // B82MA
echo Baser::setCodeset('ABCEFGHKMNPRSTUVW1235789')->getIntFromToken('B82MA'); // 646464
Everything
echo Baser::setCodeset('ABC')->bcMath()->getTokenFromInt(1337);
Simple URL Shortening service using this package

Controller Model Migration

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-25