pavelzanek/redirections-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pavelzanek/redirections-laravel

最新稳定版本:1.0.2

Composer 安装命令:

composer require pavelzanek/redirections-laravel

包简介

Manage your redirects easily.

README 文档

README

Manage your redirects easily. This package provides an easy way to integrate a redirection tool to your Laravel application.

  1. How it works
  2. Installations
  3. Optional
  4. Pruning Table
  5. Events
  6. Todos
  7. Testing
  8. Security
  9. Chnagelog
  10. License

How it works

You can manage redirects in your Laravel application. Once installed, you can create, edit, and delete redirects without the need to install additional packages.

There is a lot of consideration for application performance. The tool caches the redirect information, specifically the source url. With each request to the server, the middleware will run, which will determine whether the requested url address is not listed in the cache. If it is found here, a query will be made to the database, which will find the target url address. Meanwhile, an event is dispatched and the associated queued event listener takes care of storing the additional redirection information.

Don't forget to run php artisan queue:work, php artisan horizon or something else what you use.

It may happen that the redirection will be unused over time, or completely unused - and records will also remain in the database. For these cases, you can schedule a command that will automatically take care of cleaning the database from unused records.

Furthermore, the tool includes functions such as easy import and export of redirects, graphs of the usability of redirects, etc.

Installations

Source URLs are cached. Check if your project has cache settings configured. You can use from several prepared drivers (file, Redis, ...). Package also requires PHP 8.1 at least.

Migrations

First of all, generate and customize migration files. It can be useful, if you want to add someting (for example - some realationships).

php artisan vendor:publish --tag=redirections-migrations

Config file

php artisan vendor:publish --tag=redirections-config

Optional

Views

If you want to change design of the app, you can generate views. The tool contains several pre-made templates for different CSS frameworks. Now available:

  • Bootstrap 4
  • Bootstrap 5
  • Tailwind CSS
php artisan vendor:publish --tag=redirections-views

Translations

Also you can generate translations files.

php artisan vendor:publish --tag=redirections-translations

Pruning table with redirects

You can prune your table with redirects. There is the command for do that:

php artisan redirections:prune-database

Alternatively you can schedule this command in your kernel file (app/Console/Kernel.php):

protected function schedule(Schedule $schedule)
{
    $schedule->command('redirections:prune')->dailyAt('8:00');
}

Events

If someone uses a redirect (that is, goes to the source URL), the RedirectWasUsedEvent event is fired. So you can hook your own listener if needed.

Event::listen(\PavelZanek\RedirectionsLaravel\Events\RedirectWasUsedEvent::class, function ($event) {
    dd($event->redirect);
});

Todos

  • ✅ Publish the package
  • ✅ List of redirects - fulltext
  • ✅ List of redirects - pagination
  • ✅ Disable editing Source URL
  • ✅ Factory
  • ✅ Add more tests
  • ✅ Import / Export redirects
  • ✅ Toasts / Flash Messages
  • ⬜️ Regex Support
  • ✅ Bootstrap 5 CSS Support
  • ✅ Tailwind CSS Support
  • ⬜️ More info about redirects (referer, ...)

Testing

The tool includes several tests for easier scalability.

Security

If you've found a bug regarding security please mail zanek.pavel@gmail.com instead of using the issue tracker.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

Copyright (c) Pavel Zaněk. MIT Licensed, see LICENSE for details.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-08-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固