gnu / scaffy-core
A package that generated models based on your database entities. Works for MS SQL Server, MySql & PostgreSql.
v1.2.0
2025-07-10 13:57 UTC
Requires
- php: >=8.0
README
Scaffy Core is the framework-agnostic core of the Scaffy code generation system. It handles the business logic for generating model scaffolding based on your database schema, following a clean Hexagonal Architecture design.
โจ Features
- ๐ Completely decoupled from any PHP framework (Laravel, Symfony, etc.)
- ๐ก Provides clean ports for database and framework adapters
- ๐งฑ Reusable across Laravel, CLI tools, or other integrations
- ๐งฎ Generates model definitions from your actual database metadata
๐ฆ Requirements
- PHP 8.1+
- Composer
๐งฐ Installation
composer require gnu/scaffy-core
You can now import and use Gnu\Scaffy\Core
components in your project.
๐ง Hexagonal Architecture
Scaffy Core sits at the center of a hexagonal architecture:
+-------------------------+
| Framework Adapters | โ e.g. Laravel, CLI, Symfony, CodeIgniter...
+-------------------------+
โ
|
โ
+-------------------------+
| Scaffy Core |
| - Business logic |
| - FrameworkPort |
+-------------------------+
โ
|
โ
+-------------------------+
| Database Adapters | โ e.g. PostgreSQL, SQL Server, MySql...
+-------------------------+
๐ง Usage
Scaffy Core defines the core contracts and logic. To use it:
- Create an adapter implementing
FrameworkPort
- Create DB-specific implementations of
DatabasePort
- Inject and use them however you want (Laravel, CLI, custom)
Example usage in a Laravel adapter:
$scaffy = new ScaffyService($databasePort); $scaffy->generate($schema);
๐งฑ Components
Helpers
โ Utility functions for file and string handlingPorts\FrameworkPort
โ Interface for framework-side adapters
๐งช Example
use Gnu\Scaffy\Core\Helpers\IOHelper; $path = IOHelper::findRootDirectory('/app/Models');
โ Goals
- Maintain strict separation between business logic and frameworks
- Promote testability and flexibility across environments
- Encourage modular adapter/plugin design
- Development of Laravel APIs over exising databases.
๐ License
MIT ยฉ gnujesus