Download the PHP package connecttech/auto-render-models without Composer
On this page you can find all versions of the php package connecttech/auto-render-models. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download connecttech/auto-render-models
More information about connecttech/auto-render-models
Files in connecttech/auto-render-models
Package auto-render-models
Short Description Automatically generate model templates for developers using Laravel framework.
License MIT
Homepage https://connecttech.vn/
Informations about the package auto-render-models
Auto Render Models 🚀
Code chay làm gì cho mệt? Để tool nó gánh còng lưng!
Chào anh em, đây là gói Auto Render Models - trợ thủ đắc lực cho các đồng đạo Laravel. Nó giúp anh em tự động hóa việc tạo Eloquent Model từ database schema. Thay vì ngồi gõ từng dòng fillable, casts, hay khai báo relationship mỏi tay, thì chạy lệnh một phát là xong. Xịn sò chưa? 😎
Tại sao nên dùng? 🤔
- Tiết kiệm thời gian: Quên chuyện copy-paste model cũ đi.
- Chuẩn chỉ: Tự động detect các cột, kiểu dữ liệu, khóa ngoại (foreign keys) để tạo relationship (
belongsTo,hasMany...) chuẩn không cần chỉnh. - Dễ tùy biến: Muốn model nằm ở đâu, namespace gì, base class nào... chỉnh trong config là được hết.
- Hỗ trợ tận răng: Soft deletes, timestamps, casting JSON, Bit Booleans (cho mấy ông dùng MySQL bit)... cân tất.
Yêu cầu 🛠️
- PHP >= 8.2
- Laravel 10.x, 11.x, 12.x
- Đam mê sự lười biếng (thông minh) 🤣
Cài đặt imstall 📦
Chạy lệnh này trong terminal của dự án Laravel nhé:
(Nên để --dev vì thường mình chỉ render model lúc dev thôi, lên production thì code có sẵn rồi)
Cấu hình ⚙️
Sau khi cài xong, anh em cần publish file config ra để tùy chỉnh theo ý thích:
File config sẽ nằm ở config/models.php. Vào đó anh em có thể chỉnh:
path: Đường dẫn lưu model (mặc địnhapp/Models).namespace: Namespace của model.base_files: Nếu bậttrue, nó sẽ tạo class Base để anh em thoải mái override mà không sợ mất code khi chạy lại lệnh.except: Loại bỏ các bảng không muốn tạo model (nhưmigrations,failed_jobs...).
Sử dụng Run 🏃♂️
Dễ như ăn kẹo. Mở terminal lên và quất:
1. Render toàn bộ database (Mặc định)
Lệnh này sẽ quét connection mặc định và tạo model cho tất cả các bảng.
2. Chỉ định connection hoặc schema cụ thể
3. Render một bảng cụ thể
Chỉ muốn tạo lại model cho bảng users thôi thì làm thế này:
4. Tạo TypeScript Interfaces (New) ⚛️
Dành cho anh em Fullstack (Next.js/React/Vue). Lệnh này sẽ quét database và tạo file .d.ts hoặc .ts chứa interface chuẩn type.
Config output nằm ở config/models.php mục typescript. Rất hữu ích khi làm việc với TypeScript ở Frontend để đảm bảo Type Safety.
5. Sinh PHP Enums từ Database (New) 🎯
Laravel 11+ khuyến khích dùng PHP Enums. Tính năng này sẽ giúp ông tự động sinh các class Enum từ các cột có kiểu ENUM trong database của MySQL, sau đó tự động thêm cast vào model.
Config output nằm ở config/models.php mục enums.
Tính năng nổi bật 🔥
- ✅ Auto-Detect Relationships: Tự nhận diện khóa ngoại để build hàm quan hệ.
- ✅ Modern Laravel Style: Hỗ trợ Laravel 11+ với method
casts(): array(chỉnh trong configcasts_style) và tự động sinh PHP Enums. - ✅ TypeScript Generator: Đồng bộ Type giữa Backend và Frontend trong 1 nốt nhạc chuẩn Type Safety.
- ✅ Smart Casting: Tự động cast các cột
*_jsonsang array/json. - ✅ Clean Code: Code sinh ra sạch đẹp, chuẩn PSR.
- ✅ Interactive Mode: Giao diện dòng lệnh tương tác thông minh, không cần nhớ tham số.
Đóng góp (Contribution) 🤝
Anh em thấy lỗi hay muốn thêm tính năng gì thì cứ tự nhiên:
- Fork repo này về.
- Tạo branch mới (
git checkout -b feature/tinh-nang-xin). - Code và Commit (
git commit -m 'Thêm tính năng xịn'). - Push lên (
git push origin feature/tinh-nang-xin). - Tạo Pull Request.
Đừng ngại, mình rất welcome mọi đóng góp!
License ®️
Dự án này được phát hành dưới giấy phép MIT. Dùng thoải mái đi nhé!
Made with ❤️ by ConnectTech & devcontainerDuy.
All versions of auto-render-models with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/config Version ^10.0|^11.0|^12.0
doctrine/dbal Version ^3.6|^4.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/filesystem Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
laravel/prompts Version ^0.1|^0.2|^0.3