PHPackages                             katmore/shrturl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. katmore/shrturl

ActiveLibrary[API Development](/categories/api)

katmore/shrturl
===============

a URL shortener webservice

v1.0.2(9y ago)04MITPHPPHP &gt;=7.0.1

Since Dec 12Pushed 9y ago1 watchersCompare

[ Source](https://github.com/katmore/shrturl)[ Packagist](https://packagist.org/packages/katmore/shrturl)[ Docs](https://github.com/katmore/shrturl)[ RSS](/packages/katmore-shrturl/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

shrturl
=======

[](#shrturl)

*a URL shortener webservice*

Shrturl is a RESTful web service that behaves similar to enterprise level URL shortening services (such as bit.ly).

- Latest Version:

    -
- Documentation

    -

Terminology
-----------

[](#terminology)

- **code** or **short code**: the unique portion (token) contained in a short URL that serves as reference to full URL. The typically jibberish looking sequence of alpha numeric characters used in most URL shorteners.
- **short url**: the full URL that includes the short code (ie: )
- **target url**: the full URL that needs to be changed into a short URL

Installation
------------

[](#installation)

1. extract/copy the **shrturl project** somewhere

```
git clone https://github.com/katmore/shrturl.git
cd shrturl
```

2. create autoloader and resolve dependencies using Composer...

```
composer update
```

3. run the db-install.php script...

```
php bin/db-install.php
```

4. copy *app/config/shrturl/mysql-sample.ini* to **mysql.ini** and edit...

```
cp app/config/shrturl/mysql-sample.ini app/config/shrturl/mysql.ini
vi app/config/shrturl/mysql.ini
```

5. populate the database with initial set of randomly generated short codes...

```
php bin/make-codes.php 1000
```

Webservice Usage
----------------

[](#webservice-usage)

- Redirect to target URL:

    `https://example.com/shrt.php?code=abc`

    (where 'abc' is the code returned by "Shorten URL" request)
- Display short URL, Create if it does not exist

    - POST REQUEST METHOD `https://example.com/shrt.php?target=http://my_really_long_uri`

        - adding a query var named 'POST' to the query string to will also invoke 'POST' (if using GET REQUEST METHOD) > [https://example.com/shrt.php?POST&amp;target=http://my\_really\_long\_uri](https://example.com/shrt.php?POST&target=http://my_really_long_uri)
    - add a query var and value for 'url\_base' if you want to display a short url with a base

        > URL other than what is configured in the 'default' section of shrt-config. A value for 'url\_base' should correspond with a config var in shrt-config.php
    - POST REQUEST METHOD

        > [https://example.com/shrt.php?target=http://my\_really\_long\_uri&amp;url\_base=reallyshort](https://example.com/shrt.php?target=http://my_really_long_uri&url_base=reallyshort)

        - would display/create:
        - see example in shrt-config-example.php > \[\]
- Change Target URL

    - POST REQUEST METHOD > [https://example.com/shrt.php?changeTarget=http://a\_different\_really\_long\_uri&amp;code=abc](https://example.com/shrt.php?changeTarget=http://a_different_really_long_uri&code=abc)
    - adding a query var named 'POST' to the query string to will also invoke 'POST' (if using GET REQUEST METHOD)
- Shorten Multiple URLs

    - POST REQUEST METHOD

    > [https://example.com/shrt.php?request={JSON\_document}](https://example.com/shrt.php?request=%7BJSON_document%7D)

    - where 'target' is a valid JSON document with the following structure:

    ```
     {"shrt":{"target":["http://target_url_1","http://target_url_2","http://etc"]}}
    ```

    - adding a query var named 'POST' to the query string to will also invoke 'POST' (if using GET REQUEST METHOD)

Webservice Deployment Suggestions
---------------------------------

[](#webservice-deployment-suggestions)

- use 2 different FQDNs (fully qualified domain names) for this service

    - FQDN #1 for 'end use' the short code, such as:

    >

    - FQDN #2 for API calls to short code service, such as:

    >
- for example:

    1. on the 'end use FQDN' (#1)
        1. install/configure project as described in installation section of this document
        2. configure a url\_base in addition to the 'default'

        > see url\_base section in shrt-config-example.php

    - contains example of .htaccess or equivelent configuration for web server
    -  will work now
    - where 'abc' is the short code provided by previous call to short API

    1. on the 'API FQDN' (#2) use as described in usage section

    > in API requests to obtain a short code ensure that: provide a url\_base parameter in query that corresponds to the 'end use' that is set in your shrt-config-example.php

Legal
-----

[](#legal)

### Copyright

[](#copyright)

Flat webapp -

Copyright (c) 2012-2017 Doug Bird. All Rights Reserved.

### License

[](#license)

"shrturl" is copyrighted free software.

You can redistribute it and/or modify it under either the terms and conditions of the "[The MIT License (MIT)](https://github.com/katmore/shrturl/blob/master/LICENSE)"; or the terms and conditions of the "[GPL v3 License](https://github.com/katmore/shrturl/blob/master/GPLv3)".

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3532d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef3cde32b1ac961c229cb3e76202b38b5d1a2c571334152c6cee08c43732ce7c?d=identicon)[acksponies](/maintainers/acksponies)

---

Top Contributors

[![ackspony](https://avatars.githubusercontent.com/u/1947018?v=4)](https://github.com/ackspony "ackspony (24 commits)")

### Embed Badge

![Health badge](/badges/katmore-shrturl/health.svg)

```
[![Health](https://phpackages.com/badges/katmore-shrturl/health.svg)](https://phpackages.com/packages/katmore-shrturl)
```

###  Alternatives

[lucasdotvin/laravel-soulbscription

A straightforward interface to handle subscriptions and features consumption.

709209.3k](/packages/lucasdotvin-laravel-soulbscription)[pimax/fb-messenger-php

Facebook Messenger Bot PHP API

313188.5k2](/packages/pimax-fb-messenger-php)[ymirapp/cli

Ymir command-line tool

2622.2k](/packages/ymirapp-cli)[metabolism/wordpress-bundle

Build enterprise solutions with WordPress

765.4k1](/packages/metabolism-wordpress-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
