Download the PHP package flytachi/db-mapping without Composer
On this page you can find all versions of the php package flytachi/db-mapping. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flytachi/db-mapping
More information about flytachi/db-mapping
Files in flytachi/db-mapping
Informations about the package db-mapping
DB Mapping Library
Overview
This library provides a robust and flexible solution for mapping PHP classes and their properties to database schemas. It leverages PHP 8 attributes to define database table structures, column types, constraints, and relationships directly within your model classes. This approach reduces boilerplate code, improves maintainability, and ensures a clear, declarative definition of your database schema.
Features
- Attribute-based Schema Definition: Define database tables, columns, and constraints using PHP 8 attributes.
- Support for Various Data Types: Comprehensive support for common SQL data types, including integers, strings, booleans, dates, and more.
- Indexing and Constraints: Easily define primary keys, unique keys, and foreign key constraints.
- Extensible Architecture: Designed for easy extension to support custom attributes and database dialects.
- SQL Generation: Automatically generates SQL DDL (Data Definition Language) statements based on your class definitions.
Installation
To install the DB Mapping Library, you can use Composer:
Usage
Defining a Table
To define a database table, you can use the #[Table]
attribute on your PHP class. Each property in the class can then be annotated with various attributes to define its corresponding database column.
Generating SQL
You can use the library to generate SQL DDL statements from your defined classes. (Further examples will be provided in docs.md
)
Contributing
Contributions are welcome! Please see CONTRIBUTING.md
(if available) for details on how to contribute.
License
This project is licensed under the MIT License - see the LICENSE
file for details.
Generated by Manus AI