Download the PHP package phore/orm without Composer
On this page you can find all versions of the php package phore/orm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package orm
Phore MiniSql
Overview
Phore MiniSql is a lightweight ORM library for PHP, providing an easy-to-use interface for database operations such as create, read, update, delete (CRUD), and schema management. This README provides detailed usage instructions, including entity definitions, handling operations, indexes, foreign keys, and table/connection maintenance.
Installation
To install Phore MiniSql, use Composer:
Defining Entities
Entities are defined as PHP classes with public properties representing the columns of the corresponding database table. Each entity class must implement a static __schema method that returns an OrmClassSchema object.
Usage
Connecting to the Database
To connect to the database, create an instance of the Orm class and provide the DSN and entity classes.
Creating Records
To create a new record, instantiate the entity class, set its properties, and call the create method.
Reading Records
To read a record by its primary key, use the read method.
Updating Records
To update a record, modify its properties and call the update method.
Deleting Records
To delete a record, call the delete method.
Listing All Records
To list all records of an entity, use the listAll method.
Selecting Records with Conditions
To select records with specific conditions, use the select method.
Indexes
Indexes can be defined in the OrmClassSchema using the indexes property.
Foreign Keys
Foreign keys can be defined in the OrmClassSchema using the foreignKeys property.
Maintaining Tables and Connections
Updating Schema
To update the database schema based on the defined entities, use the updateSchema method.
Dropping All Tables
To drop all tables in the database, use the dropAllTables method.
Conclusion
Phore MiniSql provides a simple and efficient way to manage database operations in PHP. By defining entities and using the provided methods, you can easily perform CRUD operations, manage indexes and foreign keys, and maintain your database schema.