Download the PHP package mberecall/ci4-slugify without Composer

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

Latest Stable Version GitHub code size in bytes Total Downloads [![Package License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE) [![Buy me a coffee](https://img.shields.io/static/v1.svg?label=Buy%20me%20a%20coffee&message=💓&color=434b57&logo=buy%20me%20a%20coffee&logoColor=white&labelColor=13C3FF)](https://www.buymeacoffee.com/mberecall)

Contents


Simple Slugify Library for Codeigniter 4

This library provides a way of generating a unique slugs.

Background: What is a slug?

A slug is a simplified version of a string, typically URL-friendly. The act of "slugging" a string usually involves converting it to one case, and removing any non-URL-friendly characters (spaces, accented letters, ampersands, etc.). The resulting string can then be used as an identifier for a particular resource.

For example, if you have a blog with posts, you could refer to each post via the ID:

http://yourdomain.com/post/1
http://yourdomain.com/post/2

... but that's not particularly friendly (especially for SEO). You probably would prefer to use the post's title in the URL, but that becomes a problem if your post is titled "André & François took 55% of the whole space in REAC Company", because this is pretty ugly too:

http://yourdomain.com/post/Andr%C3%A9%20&%20Fran%C3%A7ois%20took%2055%%20of%20the%20whole%20space%20in%20REAC%20Company

The solution is to create a slug from the title and use that instead. You might want to use Codeigniter's built-in \url_title('This is the title','-', true) helper function to convert that title/string into slug as follow:

http://yourdomain.com/post/andre-francois-took-55-of-the-whole-space-in-reac-company

A URL like that will make users happier (it's readable, easier to type, etc.).

For more information, you might want to read this description on Wikipedia.

Slugs tend to be unique as well. So if you write another post with the same title, you'd want to distinguish between them somehow, typically with an incremental counter added to the end of the slug:

http://yourdomain.com/post/andre-francois-took-55-of-the-whole-space-in-reac-company
http://yourdomain.com/post/andre-francois-took-55-of-the-whole-space-in-reac-company-1
http://yourdomain.com/post/andre-francois-took-55-of-the-whole-space-in-reac-company-2

This keeps the URLs unique.

Installation

This package can be installed through composer require. Before install this, make sure that your are working with PHP >= 7.2 in your system. Just run the following command in your cmd or terminal:

Install the package via Composer:

Usage

After package installed in your Codeigniter project, you have now many ways you will use to generate a unique slugs for your blog posts or products. Just follow the following guides below that will teach the way you will use SlugService Class inside your controller.

SlugService Class

All the logic to generate slugs is handled by the Mberecall\CI_Slugify\SlugService class.

Generally, you don't need to access this class directly, although there is one static method that can be used to generate a slug for a given string without actually creating or saving an associated model. All you need to do, is to use the below strategies in your controller in order to generate a unique slugs.

Below are possible examples you can use to generate unique slug in your controller using SlugService class:

Updating record

when you are not inserting new record, but you're updating any existing record, you'll need to add an extra function on chain which is sid(). Below is an example of how you can generate new slug of selected record.

Class reference

\Mberecall\CI_Slugify\SlugService

table()

Arguments

model()

Arguments

sid()

Arguments

separator()

Arguments

make()

Arguments

Copyright and License

ci4-slugify was written by MB'DUSENGE Callixte (mberecall) and is released under the MIT License.

Copyright (c) 2023 MB'DUSENGE Callixte🇷🇼


All versions of ci4-slugify with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
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 mberecall/ci4-slugify contains the following files

Loading the files please wait ....