Download the PHP package leopardd/url-shortener-bundle without Composer
On this page you can find all versions of the php package leopardd/url-shortener-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package url-shortener-bundle
UrlShortenerBundle
Getting started
Folder structure
Feature & Update & Note
- [x] Example project: leopardd/bitly
- [x] Support PHP 5.6, 7.0
- [ ] Message queue
- [ ] Caching (e.g. Redis)
- Scaling
- [ ] Separate host/db/table/id
- [ ] Docker swarm setup
- [ ] what happened when ID reach maximum of MySQL
- [ ] Many databases
- [ ] Random bulk generate URL for test
- [x] Case-sensitive
- [x] Remove trailing before processing
- [ ] Change naming
EncodeService
toProcessService
- [ ] Test
EventDispatcher
- [ ] Using Symfony\Component\Validator as a service + JMS to validate data
- [ ] Implement FriendsOfSymfony/FOSRestBundle
- Properties
- [ ] Custom code
- [ ] Hits
- [ ] Expiry date
- Validate url
- [x] Is url
- [x] Remove trailing slash
- [x] No more than 255 character
- Research
- [ ] Ph3nol/UrlShortenerBundle
- [ ] mremi/UrlShortenerBundle
- [x] gomeeki/url-shortener-bundle](https://github.com/gomeeki/url-shortener-bundle/)
- Test
- [x] phpspec
- [x] PHP CodeSniffer
Algorithm
Get "short-url" process
- Insert "long-url" into database then return
row-id
- Encode
row-id
then save it
Redirect "short-url" process
- Decode incoming "short-url" then we get
row-id
- Return item in that
row-id
Reason behind "row-id" approach
Short url: produce shortened version of url
- Generate: produce a shortened version of the URL submitted
- Lookup: when the shortened version is called, look up this reference in database then return it
And the challenge is
- Lookup time
- Allow very very large number of unique ids and at the same time
- Keep the ID length as small as possible
- ID should be sort of user friendly and possibly a memorable (if possible)
- Scale with multiple instances (Sharding)
- What happens when ID reach the maximum value e.g. (if the length is 7 containing [A-Z, a-z, 0-9], we can serve 62^7 (~35k billion) urls)
- Replication, database can be crashed by many problems, how to replicate instances, recover fast ?, keep read / write consistent ?
In this bundle, we will focus on point 1. How we can reduce loop-up time.
So, In this project decide to using "Attemp 4" by using Hashids for hash function (Hashids will generate unique code from difference id)
Reference && Tool
- Inspired by gomeeki/url-shortener-bundle
- Hashids
- RegExr
Algorithm
- How to code a URL shortener?
- What are the http://bit.ly and t.co shortening algorithms?
- Create a TinyURL System
- Bloom filter
All versions of url-shortener-bundle with dependencies
PHP Build Version
Package Version
Requires
php Version
~5.6|~7.0
symfony/framework-bundle Version ~2.6|~3.0
doctrine/orm Version ^2.5
doctrine/doctrine-bundle Version ^1.6
hashids/hashids Version ^2.0
jms/serializer-bundle Version ^1.3
symfony/framework-bundle Version ~2.6|~3.0
doctrine/orm Version ^2.5
doctrine/doctrine-bundle Version ^1.6
hashids/hashids Version ^2.0
jms/serializer-bundle Version ^1.3
The package leopardd/url-shortener-bundle contains the following files
Loading the files please wait ....