teksite/handler 问题修复 & 功能扩展

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

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

teksite/handler

最新稳定版本:1.1.1

Composer 安装命令:

composer require teksite/handler

包简介

Some features to handle Laravel codes better

README 文档

README

About

A lightweight Laravel package designed to simplify common PHP and Laravel operations, including try-catch handling, database querying, and other utility functions.

Table of Contents

About

The Handler Package streamlines development by providing helper functions for managing try-catch blocks, fetching data from databases, and other common tasks in PHP and Laravel applications. It aims to reduce boilerplate code and improve code readability.

Author

Developed by Sina Zangiband.

Contact

Installation

Step 1: Install via Composer

Run the following command in your terminal:

composer require teksite/handler

Step 2: Register the Service Provider

For Laravel 10 and 11

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

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

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

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

Features

  • Simplify exception handling.
\Teksite\Handler\Actions\ServiceWrapper

example

 return app(ServiceWrapper::class)(function () use ($inputs, $post) {
       $post->update(Arr::except($inputs, ['tag', 'meta', 'seo']));
       return $post;
 });
  • Streamlined methods for querying and fetching data.
\Teksite\Handler\Services\FetchDataService

example

  public function get(mixed $fetchData = [])
  {
      return app(ServiceWrapper::class)(function () use ($fetchData) {
          return app(FetchDataService::class)(Post::class, ['title'], ...$fetchData);
      });
  }

Configuration

The package includes a configuration file for customization. Publish it using:

php artisan vendor:publish --provider="Teksite\Handler\ServiceProvider"

Edit the configuration in config/handler-settings.php to adjust settings like default query limits or error logging.

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.

统计信息

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

GitHub 信息

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

其他信息

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