Download the PHP package fbeen/uniqueslugbundle without Composer

On this page you can find all versions of the php package fbeen/uniqueslugbundle. 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 uniqueslugbundle

FbeenUniqueSlugBundle for Symfony 4

With this bundle you will be able to automatic generate unique slugs inside your entities by simply add a @Slug annotation to a specified field.

Features include:

Requirements

This bundles current release requires Symfony 4. You can use Version 1.2 from this Bundle to use it with Symfony >= 2.7

Known restrictions

(*) 8 at default conifguration or otherwise as much as the 'fbeen_unique_slug.maximum_digits' parameter (see below at "Full configuration example")

Installation

1. Run composer:

2. Adding Slug behavior to your entity:

Suppose that you have a Newsitem entity to display some news on your website and that you want to generate slugs from the $title property.

You might then have an entity like this:

Important notes when you edit your entity manually:

3. Migrate:

Apply the changes to the database:

4. Using the Slugs in your routes

From now on if you persist your entity the slug will be automatically generated. To use the slugs into the routes you could simply use the $slug property into the route e.g.

And then you have to retrieve the right newsitem using the given slug. Fortunately thanks to Symfony's automatic parameter conversion this is as easy as this:

Don't forget to pass the slug property to the router when you generate a route to your show action:

Advanced Slugs

The slug annotation has some more futures:

1) To generate slugs from more than one property just write an array of properties: @Slug({"created", "title"})

2) To add your own format for date, time and datetime fields use the format parameter: @Slug({"created", "title"}, format="Y-m-d").

3) You could also write your own method that builds the slug and apply the method name to the @Slug annotation.

Update the slugs for all records of your table

Using the Symfony console commands you are able to generate the slugs for all the records:

Create your custom (language specific) slugifier

  1. First write your own slugifier class and be sure that your class implements the Fbeen\UniqueSlugBundle\Slugifier\SlugifierInterface e.g.

  2. If you place your slugifier in the App\Service directory it will be autowired as a service. If not add a service definition in your /config/services.yaml file

  3. Add a configuration file in the config/packages directory with the name fbeen_unique_slug.yaml.

  4. Now you should run phpunit Tests/SlugifierTest in the main directory of this bundle to test your slugifier class! (you must have phpunit installed. See https://phpunit.readthedocs.io/en/8.0/installation.html)

Ready! From now on the slugs will be generated with your own slugifier class.

Full configuration example with default values


All versions of uniqueslugbundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0.8
ext-intl Version *
doctrine/inflector Version ^1.2
nikic/php-parser Version ^4.0
symfony/config Version ^3.4|^4.0
symfony/console Version ^3.4|^4.0
symfony/dependency-injection Version ^3.4|^4.0
symfony/filesystem Version ^3.4|^4.0
symfony/finder Version ^3.4|^4.0
symfony/framework-bundle Version ^3.4|^4.0
symfony/http-kernel Version ^3.4|^4.0
symfony/maker-bundle Version >1.1
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 fbeen/uniqueslugbundle contains the following files

Loading the files please wait ....