F

Back to Projects

Nexa ORM

Nexa ORM

Introduction

NexaORM is a modern PHP Object-Relational Mapping (ORM) library designed to simplify database interactions and streamline the development of PHP applications. It provides a lightweight and intuitive way to manage database entities, relationships, and queries.

Features

Why NexaORM?

Intelligent Auto-Generated Migrations:

Say goodbye to tedious manual migration creation! NexaORM's intelligent auto-generation feature analyzes your entities and creates the necessary migrations to update your database schema accordingly. This powerful feature offers several benefits:

Seamless Integration:

NexaORM seamlessly integrates with your existing development environment:

Community and Support:

Join a vibrant community of developers and contributors who actively support NexaORM:

Choose NexaORM and unlock the power of intelligent auto-generated migrations, effortless database management, seamless integration, and a supportive community. Embrace a more efficient and error-free development workflow for your PHP applications.

Installation

Use Composer to install the package:

composer require v1p3r75/nexa-orm

Preview

 
// Define entity
 
#[Entity]
class UserEntity
{
 
  #[PrimaryKey]
  #[SmallInt]
  #[AutoIncrement(true)]
  public int $id;
 
  #[Strings]
  #[DefaultValue('John')]
  public string $username;
 
  #[Number]
  #[ForeignKey(ProfileEntity::class, 'id', [Nexa::ON_DELETE => Nexa::CASCADE, Nexa::ON_UPDATE => Nexa::CASCADE])]
  #[Comment('user profile')]
  #[Nullable]
  public int $profile;
 
  #[DateAndTime]
  #[DefaultValue(Nexa::DATETIME_NOW)]
  public DateTime $created_at;
}
 
// Create a model for database interation
 
 
use Nexa\Models\Model;
use Nexa\Test\Entities\UserEntity;
 
class User extends Model
{
 
  protected $entity = UserEntity::class;
 
}
 
User::insert(['username' => 'John Doe', 'email' => 'johndoe@test.com'])
 

Authors

Resources