Download the PHP package blendbyte/filament-title-with-slug without Composer

On this page you can find all versions of the php package blendbyte/filament-title-with-slug. 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 filament-title-with-slug

"Title With Slug" Input - Easy Permalink Slugs for Filament Forms (PHP / Laravel / Livewire)

This package for FilamentPHP adds the form component TitleWithSlugInput which allows to edit titles and slugs easily.

It is inspired by the classic WordPress title & slug implementation.

The plugin is fully configurable. You can change all labels, use your own slugifier, use a route() to generate the " View" link, hide the host name, and many more. Read the full documentation

The output looks like this: (Watch » Demo Video «)

Features

Video

You can watch a short demo video of the packages below.

Table of contents

Installation

You can install the package via composer:

If needed, you can publish the config file with:

Translation

If needed, you can publish the translation files with:

You'll find the published translations here: trans/vendor/filament-title-with-slug

This package is translated to:

You translated it too? Share your translation on our GitHub discussions page.

Usage & examples

Basic usage - Add TitleWithSlugInput to a Filament Form

This package provides the custom InputField TitleWithSlugInput for the Filament Form Builder.

Read the installation details for Filament here.

Below an example, where to put the new field inside your Filament Resource.

Tip: To occupy the full width, use TitleWithSlugInput::make()->columnSpan('full').

The output looks like this:

Change model fields names

The package assumes, that you model fields are named title and slug.

You can easily change them according to your needs.

In the example below, the package now uses the database fields name for the title and identifier for the slug.

Change labels, titles, placeholder

It's possible to change all labels on the fly.

In this example, we also add the base path /books/.

Tip: You can translate the package completely.

The output looks like this:

Permalink preview: Hide host

You can hide the host part of the permalink preview.

The output looks like this:

Permalink preview: Change host and path

You can set the path and the host for the preview.

The output looks like this:

"Visit" link - Use router to generate URL with route()

You can use a named route, e.g. route('product.show', ['slug' => $record->slug]), to generated the "Visit" link.

Laravel documentation: Generating URLs To Named Routes

By default, the package concatenates the strings host + path + slug to generate the "Visit" link.

Because the "Visit" link now is generated by an route, you can use partial hosts like urlHost: 'camya.com' to shorten the permalink preview.

The output looks like this:

Hide "Visit" link

You can remove the "Visit" link completely.

Style the "title" input field

In order to style the "title" input field, you can pass the attributes class via titleExtraInputAttributes parameter.

The output looks like this:

Add extra validation rules for title or slug

You can add additional validation rules by passing in the variables titleRules or slugRules.

In addition, a unique validation rule is applied to the slug field automatically. In order to modify the unique rule, read Custom unique validation rules for title (and slug).

You can also customize the error messages.

Custom error messages

You can customize the error messages in your EditModel and CreateModel filament resources by adding the $messages member variable.

Custom unique validation rules for title (and slug)

Unique validation rules can be modified only by using the parameters titleRuleUniqueParameters and the slugRuleUniqueParameters counterpart.

This is needed in order to set Filament's "ignorable" parameter correctly.

This array is inserted into the input field's ->unique(...[$slugRuleUniqueParameters]) method.

Read Filament's documentation for the Unique method.

Available array keys:

Custom slugifier

This package uses Laravel's slugifier, Str::slug(), but it is possible to replace it with one of your own.

The following generates a slug with only the characters a-z and validates them with a regex.

Note: You can customize the validation error, see Custom error messages.

Dark Mode

The package supports Filaments dark mode. Dark mode output looks like this:

How to set a empty homepage slug

To set an empty slug, you must first remove the slug's required rule. You can do this by overwriting the slugRules array.

In the input field of the component's slug form, use the / character to set the home page.

The / character is necessary to bypass the auto slug-regenerate that would be triggered if the slug field is an empty string.

The input looks like this:

Use within a relationship repeater

You can use the TitleWithSlugInput inside a repeater with a database relation.

This example uses the Eloquent relationship "Post hasMany FAQEntries".

Read the Laravel Eloquent Relationship and the Filament Repeater docs for details.

The output looks like this:

Make a URL slug sandwich. (path/slug/path)

It is possible to create a URL with the slug in the middle of the path.

Example: "/books/ slug /detail/"

It is important to add a urlVisitLinkRoute closure to create a correct visit link. Please also read the "urlVisitLinkRoute with named route" documentation.

The output looks like this:

Use the slug as subdomain

You can use the package to create the subdomain part of a URL with the following setup.

Example: "https:// my-subdomain .camya.com"

It is important to add a urlVisitLinkRoute closure to create a correct visit link. Also, you need to set the name of the Eloquent model field for the subdomain using slugField.

Please also read the "urlVisitLinkRoute with named route" documentation.

The output looks like this:

Package config file - Set default values

This package comes with some default values that can be easily overridden programmatically.

If you have other defaults, you can publish the configuration file and change them globally.

You'll find the published config here: config/filament-title-with-slug-config.php

The values can be programmatically overridden with: TitleWithSlugInput::make(fieldTitle: 'title')

All available parameters

You can call TitleWithSlugInput without parameters, and it will work and use its default values.

In order to set parameters, you use PHP8's Named Arguments syntax.

Below is an example with some defaults overridden.

Changelog

Please see the release changelog for more information on what has changed recently.

Contributing

Want to implement a feature, fix a bug, or translate this package? Please see contributing for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

This is a fork from , updated to work with Filament v3.0.

FilamentPHP is based on Laravel, Livewire, AlpineJS, and TailwindCSS. (aka Tall Stack)

This package was inspired by a package by awcodes and the work of spatie. Thanks also to ralphjsmit for his blueprint that I used to implement the Filament Component Pest Tests.

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-title-with-slug with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0
illuminate/contracts Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.13.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 blendbyte/filament-title-with-slug contains the following files

Loading the files please wait ....