承接 tir/crud 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

tir/crud

Composer 安装命令:

composer require tir/crud

包简介

Laravel CRUD scaffolding system

README 文档

README

Version: 1.0.0 | License: MIT | Framework: Laravel 12.0+

A powerful, trait-based CRUD scaffolding framework that automates complete CRUD operations for Laravel applications with minimal boilerplate code.

🎯 Quick Overview

Tir/CRUD enables rapid development of admin panels and data management systems by:

  • ✅ Auto-generating complete CRUD operations from simple configurations
  • ✅ Providing flexible field system with validation and relations
  • ✅ Managing access control at method and UI levels
  • ✅ Supporting multiple databases through adapter pattern
  • ✅ Offering extensible hook system for customization
  • ✅ Including comprehensive testing suite with 170+ tests

✨ Features

Core CRUD Operations

  • Index - List records with filtering, searching, and pagination
  • Show - Display detailed record view
  • Create - Display creation form
  • Store - Save new records with validation
  • Edit - Display edit form
  • Update - Update existing records
  • Destroy - Soft delete records
  • Trash - List soft-deleted records
  • Restore - Restore soft-deleted records
  • Force Delete - Permanently delete records

Advanced Features

  • Scaffolder System - Configuration-driven metadata management
  • Field System - 15+ field types with validation and relations
  • Hook System - Pre/post action callbacks for custom logic
  • Access Control - Scope-based and method-level permissions
  • Service Layer - Separated business logic from controllers
  • Database Adapters - MySQL, PostgreSQL, SQLite, SQL Server support
  • Module Management - Organized module structure with admin menus
  • Audit Logging - Track all CRUD operations with user context
  • Multi-Language Support - English, German, Farsi translations

🚀 Quick Start

1. Install Package

composer require tir/crud

2. Create a Scaffolder

Define CRUD configuration for your model:

<?php

namespace App\Scaffolders;

use App\Models\User;
use Tir\Crud\Support\Scaffold\BaseScaffolder;

class UserScaffolder extends BaseScaffolder
{
    protected function setModuleName(): string
    {
        return 'users';
    }

    protected function setModel(): string
    {
        return User::class;
    }

    protected function setFields(): array
    {
        return [
            Text::make('name')->required(),
            Email::make('email')->required()->unique(),
            Text::make('phone')->nullable(),
        ];
    }
}

3. Create a Controller

<?php

namespace App\Http\Controllers;

use App\Scaffolders\UserScaffolder;
use Tir\Crud\Controllers\CrudController;

class UserController extends CrudController
{
    protected function setScaffolder(): string
    {
        return UserScaffolder::class;
    }
}

4. Register Routes

// routes/api.php
Route::middleware(['auth:sanctum'])->group(function () {
    Route::resource('users', UserController::class);
});

That's it! Your controller now has:

  • GET /users - List all users
  • GET /users/{id} - Show user details
  • POST /users - Create new user
  • PUT /users/{id} - Update user
  • DELETE /users/{id} - Delete user
  • Plus more...

📚 Documentation

For Users & Developers

Document Purpose
docs/README_COMPREHENSIVE.md Complete usage guide with quick start, features, examples, and API reference
docs/ARCHITECTURE_OVERVIEW.md Visual decision trees, quick reference, debugging guide, and common patterns
docs/QUICK_REFERENCE.md Fast lookup for common tasks and configuration

For System Design & Architecture

Document Purpose
docs/SYSTEM_DESIGN.md Deep architectural documentation, component design, data flows, and extension points
docs/ACCESS_CONTROL.md Comprehensive guide to the access control and permission system
TESTING.md Testing strategies, TDD approach, and test suite structure

Quick Navigation

🧪 Testing

The package includes an optimized Docker testing environment with automatic code coverage:

# Run tests with coverage (recommended)
./test-docker.sh

# Interactive debugging shell
./test-docker.sh interactive

# Clean up Docker resources
./test-docker.sh clean

Coverage Reports

Tests automatically generate comprehensive coverage reports:

  • HTML: coverage/html/index.html - Interactive browsable coverage
  • XML: coverage/clover.xml - For CI/CD integration

Performance

The Docker setup uses a pre-built image with all dependencies for fast test execution (~1.85 seconds total time).

Test Results

  • 170 tests with 704 assertions
  • 18.42% line coverage (344/1868 lines)
  • 10.91% method coverage (37/339 methods)

🏗️ Core Concepts

Scaffolder

Defines CRUD metadata for a model (fields, actions, buttons)

Fields

Form/table field definitions with validation, relations, and formatting

Hooks

Pre/post action callbacks for extending CRUD operations

Access Control

Scope-based and method-level permission management

Services

Business logic separation from controllers (Store, Update, Data services)

💡 Common Use Cases

Admin Panel

Complete CRUD interface with filters, search, and pagination

API Backend

RESTful CRUD endpoints with automatic validation

Data Management

Complex forms with relations and custom business logic

Multi-tenant Applications

Scope-based access control per tenant

🔌 Extension Points

  • Custom Fields - Extend BaseField for domain-specific inputs
  • Custom Hooks - Intercept and modify any CRUD operation
  • Custom Services - Replace business logic services
  • Database Adapters - Add support for new database systems
  • Middleware - Add custom request processing

🐛 Troubleshooting

403 Forbidden? → Check access control configuration
Validation errors? → Ensure field validation is set correctly
Relations not loading? → Verify model relationship exists
Routes not found? → Check route registration

See docs/ARCHITECTURE_OVERVIEW.md - Debugging Checklist for detailed solutions.

📦 Requirements

  • Laravel 12.0+
  • PHP 8.1+
  • Composer

🔗 Quick Links

Resource Link
Main README README.md
Comprehensive Guide docs/README_COMPREHENSIVE.md
System Design docs/SYSTEM_DESIGN.md
Architecture Overview docs/ARCHITECTURE_OVERVIEW.md
Access Control docs/ACCESS_CONTROL.md
Quick Reference docs/QUICK_REFERENCE.md
Testing TESTING.md

📄 License

MIT License - see LICENSE file for details

👨‍💻 Contributing

Contributions are welcome! Please ensure tests pass:

./test-docker.sh

📧 Support

  • GitHub Issues - Report bugs or request features
  • Documentation - See comprehensive docs above
  • Examples - Check architecture overview for patterns

🙏 Credits

Created by Tirdad Abbasi
Email: abbasi.tirdad@gmail.com

📚 Additional Resources

tir/crud 适用场景与选型建议

tir/crud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.7k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 10 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tir/crud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tir/crud 我们能提供哪些服务?
定制开发 / 二次开发

基于 tir/crud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-29