PHP code example of denason / persian-slug

1. Go to this page and download the library: Download denason/persian-slug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

denason / persian-slug example snippets


Denason\PersianSlug\PersianSlugServiceProvider::class,

slug_fa('سلام دنیا ۱۲۳'); // Output: سلام-دنیا-123

use Denason\PersianSlug\SlugGenerator;

SlugGenerator::make('سلام دنیا ۱۲۳'); // Output: سلام-دنیا-123

SlugGenerator::make(
    string $text,
    string $separator = '-',
    bool $convertNumber = true,
    bool $useLaravelSlug = false
): string

use Denason\PersianSlug\Concerns\HasSlug;

class Post extends Model
{
    use HasSlug;

    protected $slugSource = 'title';      // Field to slugify
    protected $slugField  = 'slug';        // Field to store slug
}