diepxuan / laravel-support
Specifies a brief summary of the PHP package, indicating its purpose as a support tool for developers.
0.1.7
2026-03-01 09:52 UTC
Requires
README
Package hỗ trợ và tiện ích cho Laravel.
📚 Documentation
- Project Docs: Serve:Dev Commands - Development server commands
- Project Docs: Package Namespace Conventions
Mô tả ngắn gọn
Cung cấp các công cụ hỗ trợ cho developer trong hệ thống DX, bao gồm:
- Mở rộng Collection với tiện ích markdown
- Command quản lý npm tự động
- Hệ thống serve:dev commands để quản lý development server (Laravel + Vite)
Chức năng chính
1. Collection Extension
- Class
Collectionmở rộng từIlluminate\Support\Collection - Phương thức
toMarkdownTablechuyển collection thành bảng markdown (hỗ trợ UTF-8, căn chỉnh cột)
2. NPM Management Command
- Command
app:dev:npmtự động chạynpm install(nếu thiếu node_modules) - Khởi động
npm run watchở background - Quản lý PID file tránh trùng lặp process
- Tích hợp với Laravel scheduling (tự động chạy mỗi phút)
3. Serve:Dev Commands (Development Server)
serve:dev- Start Laravel + Vite development serversserve:dev:stop- Stop development serversserve:dev:status- Check server statusserve:dev:health- Health check với auto-recoveryserve:dev:service- Systemd service managementserve:dev:logs- View logs real-time
Xem chi tiết: docs/SERVE-DEV-COMMANDS.md
4. Charset Support
- Hỗ trợ xử lý charset thông qua dependency php-charset
Cài đặt / Sử dụng
composer require diepxuan/laravel-support
Package không có ServiceProvider, cần đăng ký command thủ công trong app/Console/Kernel.php:
protected $commands = [ \Diepxuan\Support\Commands\Npm::class, \Diepxuan\Support\Commands\ServeDev::class, \Diepxuan\Support\Commands\ServeDevStop::class, \Diepxuan\Support\Commands\ServeDevStatus::class, \Diepxuan\Support\Commands\ServeDevHealth::class, \Diepxuan\Support\Commands\ServeDevService::class, \Diepxuan\Support\Commands\ServeDevLogs::class, ];
Sử dụng Collection
use Diepxuan\Support\Collection; $collection = new Collection([['name' => 'John', 'age' => 30], ...]); echo $collection->toMarkdownTable(['name' => 'Tên', 'age' => 'Tuổi']);
Sử dụng NPM Command
php artisan app:dev:npm
Command sẽ kiểm tra node_modules, cài đặt nếu cần, và khởi chạy npm run watch với PID lưu tại storage/watch.pid.
Sử dụng Serve:Dev Commands
# Start development server php artisan serve:dev # Check status php artisan serve:dev:status # Health check with auto-fix php artisan serve:dev:health --fix # Install as systemd service sudo php artisan serve:dev:service install # Stop servers php artisan serve:dev:stop
Xem chi tiết: docs/SERVE-DEV-COMMANDS.md
Cấu trúc thư mục
laravel-support/
├── config/
│ └── config.php # Cấu hình package
├── src/
│ ├── Collection.php # Class Collection mở rộng
│ └── Commands/
│ ├── Npm.php # Command npm tự động
│ ├── ServeDev.php # Main serve:dev command
│ ├── ServeDevStop.php # Stop command
│ ├── ServeDevStatus.php # Status command
│ ├── ServeDevHealth.php # Health check
│ ├── ServeDevService.php # Service management
│ └── ServeDevLogs.php # Log viewer
├── docs/
│ ├── CODE-STYLE-AND-FORMATTING.md
│ └── SERVE-DEV-COMMANDS.md # Serve:dev documentation
├── .editorconfig
├── .gitignore
├── .php-cs-fixer.dist.php
├── LICENSE
├── README.md
└── composer.json
Liên kết đến các package liên quan
- diepxuan/php-charset (xử lý charset)
- diepxuan/laravel-core (core chung)
Tài liệu
Ghi chú
Package hỗ trợ các tiện ích nhỏ nhưng hữu ích cho quá trình phát triển:
- Command npm tự động giúp duy trì watch mode cho frontend assets
- Collection markdown table hữu ích cho việc generate report trong console
- Serve:dev commands thay thế hoàn toàn external scripts, tích hợp đầy đủ development server management