Download the PHP package easybook/slugger without Composer

On this page you can find all versions of the php package easybook/slugger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package slugger

Slugger

slugger is a fast PHP library to generate slugs, which allows to safely include any string as part of an URL. Slugs are commonly used for CMS, blogs and other content-related platforms.

Installation

The easiest way to install slugger is to add this library as a dependency of your project using Composer:

If you prefer, add the new dependency by hand to your composer.json file and then, execute the composer update command to update your dependencies:

Generating slugs

Most slugger libraries include a lot of settings to configure how the slugs are generated. slugger uses a different approach to offer both a great performance and enough flexibility: it includes four different slugger classes!

All sluggers implement the SluggerInterface interface, which allows you to safely switch in your projects from one slugger to another.

Generating basic slugs

The easiest way to generate slugs is to use the slugify() method of the Slugger class:

If you use PHP 5.5.0 or higher, you can generate slugs with a single line of code:

Generating unique slugs

If you need to ensure the uniqueness of the slugs generated during the execution of your application, use the uniqueSlugify(), which appends a random suffix to the slug:

Keep in mind that the generation of the unique slugs is non-deterministic, meaning that the appended suffix is random and it will change in each application execution, even when using the same input string.

If you want to append an autoincremental numeric suffix to the slugs, you'll need to develop your own custom solution.

Generating slugs for complex languages

If the strings contain characters belonging to complex languages such as Arabic, Hebrew and Japanese, you should use the Utf8Slugger class. This slugger requires PHP 5.4.0 or higher because it uses the built-in PHP transliterator:

Utf8Slugger also defines the uniqueSlugify() to generate unique slugs.

Generating SEO slugs

The SeoSlugger (and the related SeoUtf8Slugger) augments the strings before turning them into slugs. The conversions are related to numbers, currencies, email addresses and other common symbols:

SeoSlugger and SeoUtf8Slugger also define the uniqueSlugify() to generate unique slugs.

Configuration options

The only configuration option defined by slugger is the separator character (or string) used to separate each of the slug parts. First, you can set this parameter globally using the class constructor:

You can also set this parameter as the second optional argument of the slugify() and uniqueSlugify() methods. This parameter always overrides any global parameter set by the class:

License

slugger library is licensed under the MIT license.

Tests

The library is fully unit tested. If you have PHPUnit installed, execute phpunit command to run the complete test suite:

Code Quality Assurance

SensioLabs Insight Travis CI Scrutinizer CI
SensioLabsInsight Travis CI status Scrutinizer Quality Score

All versions of slugger with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package easybook/slugger contains the following files

Loading the files please wait ....