PHPackages                             hirossyi73/url-shorter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hirossyi73/url-shorter

ActiveProject[Utility &amp; Helpers](/categories/utility)

hirossyi73/url-shorter
======================

Encode and decode url shorter.

v1.0.1(2y ago)112191[1 issues](https://github.com/hirossyi73/url-shorter/issues)MITPHPPHP &gt;=8.0.0

Since Jul 12Pushed 2y agoCompare

[ Source](https://github.com/hirossyi73/url-shorter)[ Packagist](https://packagist.org/packages/hirossyi73/url-shorter)[ RSS](/packages/hirossyi73-url-shorter/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Url Shorter
===========

[](#url-shorter)

This is a library that generates and restores shortened URLs.

[日本語版 ReadMe](docs/Readme_ja.md)

Requirement
-----------

[](#requirement)

- PHP &gt;= 8.0.0
- Laravel &gt;= 9.0.0

Functions
---------

[](#functions)

- Generate shortened URL
- Restore shortened URL
- Generate short URL from screen(Switchable ON/OFF as an option)
- Generate short URL with API(Switchable ON/OFF as an option)
- Restore short URL with API(Switchable ON/OFF as an option)
- Function that requires password authentication when shortening with screen/API(Switchable ON/OFF as an option)
- Short URL preview function(Switchable ON/OFF as an option)
- Screen/API endpoint change function
- Change the number of random characters in shortened URL
- Change the character type used in the shortened URL

Quick Start
-----------

[](#quick-start)

- Start the console and move to the folder you want to install.
- Install laravel.

```
composer create-project "laravel/laravel" .

```

- Install Url Shorter.

```
composer require hirossyi73/url-shorter

```

- Open ".env" file, input database info.

```
DB_CONNECTION=mysql
DB_HOST=(Host Name)
DB_PORT=(Port Name)
DB_DATABASE=(Database Name)
DB_USERNAME=(User Name)
DB_PASSWORD=(Password)

# To enable the shortened URL function from the screen
URL_SHORTER_ENABLED_WEB_MAKE=true

```

- Enter the following command.

```
php artisan vendor:publish --provider="Hirossyi73\UrlShorter\UrlShorterServiceProvider"
php artisan migrate

```

- Start the server.

```
php artisan serve

```

Try
---

[](#try)

- By accessing the following URL, it will transition to the shortened URL generation screen.
    http(s)://(URL)/make
- Enter the URL and click the "Convert" button.

[![Generate URL](docs/img/screen1.gif)](docs/img/screen1.gif)

- You can redirect to the original URL by pasting the generated URL in the browser.

Password Authentication
-----------------------

[](#password-authentication)

Password authentication can be set on the shortened URL generation screen.

- Open the ".env" file and enter the following information.

```
URL_SHORTER_AUTH_USE=true
URL_SHORTER_AUTH_PASSWORD=(Password)

```

- Now, when you access the shortened URL generation screen, you will be prompted for password authentication.

[![Generate URL](docs/img/screen3.gif)](docs/img/screen3.gif)

Preview
-------

[](#preview)

- When you enter the shortened URL in the browser, you can display the preview screen without directly redirecting.
- Open the ".env" file and enter the following information.

```
URL_SHORTER_USE_PREVIEW=true

```

- If you enter the shortened URL in your browser, you will be prompted for a preview.

[![Generate URL](docs/img/screen2.gif)](docs/img/screen2.gif)

API
---

[](#api)

You can use the API.

- Open the ".env" file and enter the following information.

```
URL_SHORTER_ENABLED_API=true #When using original URL recovery from shortened URL
URL_SHORTER_ENABLED_API_MAKE=true #When using shortened URL generation

```

- You can now use the shortened URL API.

### Generate short URL

[](#generate-short-url)

```
http(s)://(URL)/api/make POST
Content-Type : application/json

POST VALUE:
{
  "url": "(URL to shorten)"
}

RETURN VALUE:
{
  "url": "(URL to shorten)",
  "key": "(Key)",
  "updated_at": "(Updated Datetime)",
  "created_at": "(Created Datetime)",
  "generate_url": "(Generate URL)"
}

```

### Restore from shortened URL

[](#restore-from-shortened-url)

```
http(s)://(URL)/api/g POST
Content-Type : application/json

POST VALUE:
{
  "generate_url": "(Shortened URL)"
}

RETURN VALUE:
{
  "url": "(URL to shorten)",
  "key": "(Key)",
  "updated_at": "(Updated Datetime)",
  "created_at": "(Created Datetime)",
  "generate_url": "(Generate URL)"
}

```

Setting Value
-------------

[](#setting-value)

Add to ".env" file.

#### URL\_SHORTER\_USE\_PREVIEW

[](#url_shorter_use_preview)

When using the preview function, set true(Default : false)

#### URL\_SHORTER\_AUTH\_USE

[](#url_shorter_auth_use)

When password authentication is performed with the shortened URL generation function, set true(Default : false)

#### URL\_SHORTER\_AUTH\_PASSWORD

[](#url_shorter_auth_password)

Password string for password authentication

#### URL\_SHORTER\_GENERATE\_WORDS

[](#url_shorter_generate_words)

Character string used when generating a shortened URL

#### URL\_SHORTER\_GENERATE\_LENGTH

[](#url_shorter_generate_length)

Number of characters when generating a shortened URL

#### URL\_SHORTER\_GENERATE\_CHECK\_ALREADY\_EXISTS

[](#url_shorter_generate_check_already_exists)

When true, check existence after creating short keys(Default : true)

#### URL\_SHORTER\_ENABLED\_WEB

[](#url_shorter_enabled_web)

If true, use redirect page when accessing shortened URL(Default : true)

#### URL\_SHORTER\_ENABLED\_WEB\_MAKE

[](#url_shorter_enabled_web_make)

When true, use shortened URL generation page(Default : false)

#### URL\_SHORTER\_ENABLED\_API

[](#url_shorter_enabled_api)

When true, use API to get original URL from shortened URL(Default : false)

#### URL\_SHORTER\_ENABLED\_API\_MAKE

[](#url_shorter_enabled_api_make)

When true, use shortened URL generation API(Default : false)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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 ~1293 days

Total

2

Last Release

837d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.0.0

v1.0.1PHP &gt;=8.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3859203?v=4)[h-sato](/maintainers/h-sato)[@h-sato](https://github.com/h-sato)

### Embed Badge

![Health badge](/badges/hirossyi73-url-shorter/health.svg)

```
[![Health](https://phpackages.com/badges/hirossyi73-url-shorter/health.svg)](https://phpackages.com/packages/hirossyi73-url-shorter)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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