Download the PHP package joedevsharp/entitylite without Composer
On this page you can find all versions of the php package joedevsharp/entitylite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joedevsharp/entitylite
More information about joedevsharp/entitylite
Files in joedevsharp/entitylite
Package entitylite
Short Description A lightweight PHP ORM inspired by Entity Framework, designed to simplify database interactions and provide an intuitive way to manage entities and relationships. This library utilizes a fluent interface and follows the PSR-4 autoloading standard, making it easy to integrate into any PHP project. With support for basic CRUD operations and a focus on simplicity and performance, this ORM empowers developers to work with databases seamlessly while maintaining clean and maintainable code.
License
Informations about the package entitylite
Here is a documentation draft for your EntityLite
library in PHP, including code examples to demonstrate how to use its components effectively.
EntityLite Documentation
EntityLite is a lightweight PHP ORM inspired by Entity Framework, designed to simplify database interactions using an object-oriented approach. This documentation provides an overview of the core classes and how to use them.
Table of Contents
- Installation
- Database Connection
- DbContext
- Entity and DbSet
- BaseRepository
- Example Usage
Installation
Make sure to include the EntityLite
library in your project. If you are using Composer, ensure your composer.json
is properly configured.
Database Connection
To connect to your database, you will use the Database
class. It requires the database credentials to establish a connection.
Constructor Parameters
host
: The database host.username
: The username for the database.password
: The password for the database.dbname
: The name of the database.
DbContext
The DbContext
class manages database operations and holds references to entity sets.
Adding Entities
You can add entity sets to the DbContext
using the addEntity
method.
Retrieving Entities
You can access the added entities as properties of the DbContext
instance.
Entity and DbSet
Entity Class
The Entity
class serves as a base class for your entities. It includes a method to convert an object’s properties to an array.
DbSet Class
The DbSet
class extends the BaseRepository
class, allowing for CRUD operations on entities.
BaseRepository
The BaseRepository
class provides common methods for database operations, including findAll
, findById
, insert
, update
, and delete
.
Method Examples
Find All Records
Find Record by ID
Insert Record
Update Record
Delete Record
Example Usage
Here's a complete example of how to use the EntityLite
library to manage a User
entity.
Conclusion
The EntityLite
library provides a simple and effective way to manage database operations in PHP using an object-oriented approach. By following the examples provided in this documentation, you can easily implement your own entities and utilize the available methods for CRUD operations.
For further information and advanced usage, feel free to explore the source code and adapt it to your needs.