PHPackages                             prettyurl/prettyurl - 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. prettyurl/prettyurl

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

prettyurl/prettyurl
===================

Class to create clean Urls for blogs, forums and other websites

015PHP

Since Jun 30Pushed 11y ago1 watchersCompare

[ Source](https://github.com/SiroDiaz/PrettyURL)[ Packagist](https://packagist.org/packages/prettyurl/prettyurl)[ RSS](/packages/prettyurl-prettyurl/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PrettyURL
=========

[](#prettyurl)

Class to create clean Urls for blogs, forums and other websites

Composer
--------

[](#composer)

```
$ composer require prettyurl/prettyurl:dev-master

```

Quick Start and Examples
------------------------

[](#quick-start-and-examples)

### PrettyUrl class

[](#prettyurl-class)

#### Methods

[](#methods)

setUrl, getUrl, setType, getType, setMaxLength, getMaxLength, setBlackList, getBlackList, loadDict, addChars, validate, Urlify

#### Examples

[](#examples)

To generate URLs for titles or sections

```
require 'lib/PrettyUrl.php';
use PrettyUrl;

$url = new PrettyUrl('TweetBeeg to write tweets with more than 140 characters');
$newUrl = $url->Urlify();
echo $newUrl;   // or echo $url->getUrl(), is the same
// result: 'tweetbeeg-to-write-tweets-with-more-than-140-characters'
```

Generate URLs and eliminate words from the black list

```
require 'lib/PrettyUrl.php';
use PrettyUrl;

$url = new PrettyUrl('TweetBeeg to write tweets with more than 140 characters');
// black list is case insensitive so 'WItH' is the same that 'with'
$url->setBlackList(array(
    'with', 'to'
));
$url->Urlify();
// now with the encoded url and without with and than words
echo $url->getUrl();
// result: 'tweetbeeg-write-tweets-more-than-140-characters'
```

Automatically delete invalid characters from URLs

```
require 'lib/PrettyUrl.php';
use PrettyUrl;

$text = '  bes\t    tíñtle$ $ that.\'_ _can# be mundo/ / ( \3000€ /set%&$@   ';
$url = new PrettyUrl($text);
$url->Urlify();
echo $url->getUrl();
// result: 'best-tintle-that-can-be-mundo-3000-set'
```

Generating URLs for files

```
require 'lib/PrettyUrl.php';
use PrettyUrl;

/* if the second parameter is true adapt the URL
 * to files keeping the extension
 * by default the value is false
 */

$url = new PrettyUrl('TweetBeeg tall tweets.jpg', true);
$newUrl = $url->Urlify();
echo $newUrl;
// result: 'tweetbeeg-tall-tweets.jpg'
```

Generating URLs with a determinate length. If the length is higher that the defined the Url will be shorted.

```
require 'lib/PrettyUrl.php';
use PrettyUrl;

$url = new PrettyUrl('TweetBeeg tall tweets $$Jlkjs~write more than  ?¿  140 character$=@');
/*
 * also valid
 * $url = new PrettyUrl('TweetBeeg tall tweets $$Jlkjs~write more than  ?¿  140 character$=@', false, 20);
 */
$url->setMaxLength(20);
$newUrl = $url->Urlify();
echo $newUrl;
// result: 'tweetbeeg-tall-tweet'
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7469286?v=4)[Siro Díaz Palazón](/maintainers/SiroDiaz)[@SiroDiaz](https://github.com/SiroDiaz)

---

Top Contributors

[![SiroDiaz](https://avatars.githubusercontent.com/u/7469286?v=4)](https://github.com/SiroDiaz "SiroDiaz (8 commits)")

### Embed Badge

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

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

PHPackages © 2026

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