Download the PHP package boomdraw/laravel-canonicalizable without Composer

On this page you can find all versions of the php package boomdraw/laravel-canonicalizable. 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 laravel-canonicalizable

Laravel Canonicalizable

Canonicalizable trait for Eloquent model

Build Status StyleCI Code Coverage Quality Score Latest Version on Packagist Total Downloads PHP Version License

This package provides a trait that will generate a canonicalized field when saving any Eloquent model.

Installation

Via Composer

Lumen

Uncomment the following line in the bootstrap file:

Register CanonicalizerServiceProvider

Usage

Your Eloquent models should use the Boomdraw\Canonicalizable\HasCanonical trait, the Boomdraw\Canonicalizable\CanonicalFieldsCollection and the Boomdraw\Canonicalizable\CanonicalField classes.

The trait contains an abstract method getCanonicalFields() that you must implement yourself.

Your models' migrations should have a field to save the canonicalized value.

Here's an example of how to implement the trait:

With its migration:

By default, the package will generate non-unique canonicalized fields. You can disallow duplicates by calling disallowDuplicate().

The canonicalized uniqueness will be checked even if it has been set manually and doNotGenerateOnUpdate or doNotGenerateOnCreate are used.

The canonicalized will be made unique by appending - and a number.

To add a custom separator between canonicalized and a number, pass it as an arg to disallowDuplicate().

You can call a custom canonicalization method by providing the field type.

The trait will look for method canonicalizeOther(string $string) in the model and other(string $string) method in the boomdraw/canonicalizer and it's macroses.

The canonicalization method also can be provided by using the callback function.

The type will be ignored if the callback function provided.

You can pass additional arguments to the type based method by providing an array of arguments in the type method.

You can also override the generated canonical just by setting it to another value than the generated canonical.

To force the canonicalization when a canonical is set manually use forceCanonicalization() method.

If you don't want to create the canonical when the model is initially created you can set use the doNotGenerateOnCreate() function.

If you don't want to create the canonical when the model is initially created you can set use the doNotGenerateOnUpdate() function.

This can be helpful for creating fields that don't change until you explicitly want it to.

If you want to explicitly update the canonical on the model you can call canonicalize(string $fieldName) on your model at any time to regenerate the canonical according to your other options. Don't forget to save() the model to persist the update to your database.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

You can run the tests with:

Contributing

Please see CONTRIBUTING for details and a todo list.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

License

MIT


All versions of laravel-canonicalizable with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4
boomdraw/canonicalizer Version ^2
illuminate/database Version ^6.0
illuminate/support Version ^6.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 boomdraw/laravel-canonicalizable contains the following files

Loading the files please wait ....