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

This package is auto-updated.

Last update: 2025-09-10 14:20:43 UTC


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:

  1. Create an adapter implementing FrameworkPort
  2. Create DB-specific implementations of DatabasePort
  3. 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 handling
  • Ports\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