定制 teksite/extralaravel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

teksite/extralaravel

最新稳定版本:2.0.1

Composer 安装命令:

composer require teksite/extralaravel

包简介

this package add some features such as rules, middlewares, functions to laravel

README 文档

README

Extra Laravel Package

A powerful Laravel package that enhances your application with additional middleware, validation rules, artisan commands, and configuration utilities.

Table of Contents

  • About
  • Author
  • Contact
  • Installation
  • Features
    • Middleware
    • Enums Files
    • Custom Casts
    • Artisan Commands
    • Validation Rules
    • etc.
  • Support

About

The Extra Laravel Package provides a collection of useful tools to streamline development in Laravel. It includes middleware for security, custom validation rules, artisan commands for rapid development, and configuration utilities for localization and more.

Author

Developed by Sina Zangiband.

Contact

Installation

Step 1: Install via Composer

Run the following command in your terminal:

composer require teksite/extralaravel

Step 2: Register the Service Provider

For Laravel > 9

Add the service provider to the bootstrap/providers.php file:

<?php

return [
    // Other providers
    Teksite\Extralaravel\ServiceProvider::class,
];

For Laravel 5.x and Earlier

Add the service provider to the config/app.php file under the providers array:

'providers' => [
    // Other Service Providers
    Teksite\Extralaravel\ServiceProvider::class,
],

Note: Laravel 5.5 and above supports auto-discovery, so this step is not required for newer versions.

Features

Middleware

Enhance your application's security with the included honeypot middleware:

\Teksite\Extralaravel\Middleware\HoneypotMiddleware::class

Add it to your app/Http/Kernel.php under the $middleware or $routeMiddleware array as needed.

Enum Files

The package provides Enum files for various purposes, such as:

  • Areas: Geographic regions
  • Langs: Language settings
  • Currencies: Currency formats
  • LocalLangs: Localized language settings
  • MobilePatterns: Mobile number formats

Custom Casts

Simplify data handling with custom casts:

use Teksite\Extralaravel\Casts\SlugCast;
use Teksite\Extralaravel\Casts\IpCast;
use Teksite\Extralaravel\Casts\DateCast;

protected $casts = [
    'slugColumn' => SlugCast::class,
    'dateColumn'=> DateCast::class
    'ip_addressColumn' => IpCast::class,
];

Artisan Commands

Boost productivity with custom artisan commands:

  • API Request Generator: Create a request class that returns validation, messages, and responses in JSON format.

    php artisan make:request-api <name>
  • Logic Class Generator: Separate your HTTP layer from the logical layer.

    php artisan make:logic <name>
  • Soft Delete Controller: Generate a controller with soft delete functionality.

    php artisan make:controller-trash <name>

Validation Rules

The package includes custom validation rules tailored for specific use cases:

  • Iranian National ID:

    use Teksite\Extralaravel\Rules\CodeMeliRule;
    
    'national_id' => ['required', new CodeMeliRule],
  • Mobile Number Format:

    use Teksite\Extralaravel\Rules\MobileRule;
    
    'mobile' => ['required', new MobileRule(\Teksite\Extralaravel\Enums\MobilePatterns::iran)],
  • Never Pass Rule: Useful for testing or blocking specific inputs.

    use Teksite\Extralaravel\Rules\NeverPassRule;
    
    'input' => ['required', new NeverPassRule],
  • No HTML: Prevent HTML tags in input fields.

    use Teksite\Extralaravel\Rules\NoHtmlRule;
    
    'content' => ['required', new NoHtmlRule],

Support

For questions, issues, or feature requests, please reach out via:

Contributions are welcome! Feel free to submit a pull request or open an issue on GitHub.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固