Download the PHP package zymawy/arabify without Composer
On this page you can find all versions of the php package zymawy/arabify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zymawy/arabify
More information about zymawy/arabify
Files in zymawy/arabify
Package arabify
Short Description :closed_lock_with_key: A Wrapper Sluggable Traits, To Deal With Arabic Langauge
License MIT
Homepage https://github.com/zymawy/arabify
Informations about the package arabify
Generate slugs when saving Laravel Eloquent models
| This Is Just A Wrapper Package To Support Arabic Languages Slug
Provides a HasSlug trait that will generate a unique slug when saving your Laravel Eloquent model.
Installation
Update your project's composer.json
file.
You may want to change the function you can do change it from the config
Usage
Your Eloquent models can use the Zymawy\Arabfiy\HasSlug
trait and the Zymawy\Arabfiy\SlugOptions
class.
The trait has a protected method getSlugOptions()
that you can implement for customization.
Here's an example:
If you want to generate your slug from a relationship.
Config
You do not have to add the method in you model (the above will be used as default). It is only needed when you want to change the default behaviour.
By default it will generate a slug from the name
and save to the slug
column.
It will suffix a -1
to make the slug unique. You can disable it by calling makeSlugUnique(false)
.
It will use the -
as a separator. You can change this by calling slugSeperator('_')
.
You can use multiple fields as the source of the slug generateSlugFrom(['firstname', 'lastname'])
.
You can also pass a callable
function to generateSlugFrom()
.
Have a look here for the options and available config functions.
Credits
- Ben-Piet O'Callaghan - Initial work - bpocallaghan
- Hamza Zymawy - contributor - zymawy
See also the list of contributors who participated in this project.