Download the PHP package ruthgeridema/laravel-url-rewrites without Composer

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

Easily add URL rewrites to a Laravel app

Latest Version on Packagist Build Status Quality Score StyleCI Total Downloads

Very easy to use URL rewrite package. Follow the instructions and you're good to go!

You can find an example project on my Github: view example project
This example project features the following:

Requirements

This package requires Laravel 5.8 or higher, PHP 7.2 or higher and a database that supports json fields and functions such as MySQL 5.7 or higher.

Installation

You can install the package via composer:

The package will automatically register itself.

Register the routes the feeds will be displayed on using the rewrites-macro.
You need to place it at the bottom of your routes file.

You can publish the migration with:

After the migration has been published you can create the url_rewrites table by running the migration:

You can optionally publish the config file with:

This is the contents of the published config file:

Laravel Nova

Using Laravel Nova? You can publish the Nova class to App/Nova with the following command

In the near future I will publish a Laravel Nova package with features like reindexing the URL rewrites.

Usage

Forward request

Let's say you've got a controller route 'product/{id}' and you have a product 'Apple Airpods' with id=5.
When you visit 'apple-airpods' this package will forward the request to the controller but keeps the clean url.

The following code adds this to the database:

Use named routes

You must specify the types in the config.

To regenerate the target path you can use

To automatically add the URL attribute to an Eloquent model, you have to add the HasUrlRewrite trait to an Eloquent model.
You also need to add the urlRewriteType and optionally add 'url' to the appends array.

Once this is done you can simply call Model::find(1)->url to get the url of the model.

Redirect

301 redirect

302 redirect

Other functions

Testing

  1. Copy .env.example to .env and fill in your database credentials.
  2. Run composer test.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

Special thanks for Spatie for their guidelines and their packages as an inspiration

License

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


All versions of laravel-url-rewrites with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
laravel/framework Version *
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 ruthgeridema/laravel-url-rewrites contains the following files

Loading the files please wait ....