Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 61 | All time: 10,489 This week: 673![]() |
Version | License | PHP version | Categories | |||
slug 1.0 | The PHP License | 5 | PHP 5, Text processing |
Description | Author | |
This is a simple class that can generate a slug text to use in a URL from a string. |
Hi with the help of this page you can generate simple Slug
<?php
require_once './vendor/autoload.php';
use Channaveer\Slug\Slug;
$string = "How To Create A Composer Package? Test It Locally And Add To Packagist Repository";
echo Slug::create($string);
<?php
require_once './vendor/autoload.php';
use Channaveer\Slug\Slug;
$title = "How To Create A Composer Package? Test It Locally And Add To Packagist Repository";
$slug = Slug::create($title);
/ Following is the simple PDO Query to check the
total number of blog with similar slug name/
$blog_count_stmt = $pdo->prepare("
SELECT
COUNT(`id`) slug_count
FROM
`articles`
WHERE
`slug` LIKE :slug
");
$blog_count_stmt->execute([
":slug" => "%".$slug."%"
]);
$blog_count = $blog_count_stmt->fetchObject();
if ($blog_count && $blog_count->slug_count > 0) {
$article_increment = $blog_count->slug_count + 1;
$slug = $slug . '-' . $article_increment;
}
echo 'Your unique slug - <br/>'. $slug;
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Doc. | Read me |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.