GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - michelphp/paper-orm: PaperORM is a PHP ORM designed for projects requiring a lightweight yet performant object-relational mapping solution. Specifically developed for PHP 7.4 and above, it positions itself as a lighter alternative to existing solutions.

BranchesTags
Open more actions menu

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
benchmark
benchmark
 
 
docs
docs
 
 
src
src
 
 
tests
tests
 
 
.env.test.dist
.env.test.dist
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 

Repository files navigation

PaperORM

The ORM that does what you wrote, and nothing else.

Map your entities with attributes, query them through repositories, migrate your schema. No lazy loading, no cascade, no transaction you did not open. Every query runs because you asked for it.

PHP 8.2+ · SQLite · MariaDB / MySQL · Symfony bundle

📖 Documentation · Website

Install

composer require michel/paper-orm          # any PHP project
composer require michel/paper-orm-bundle   # Symfony

Quick start

use Michel\PaperORM\EntityManager;
use Michel\PaperORM\PaperConfiguration;

$em = EntityManager::createFromConfig(
    PaperConfiguration::fromDsn('sqlite:///var/data/app.sqlite')
);
use Michel\PaperORM\Entity\EntityInterface;
use Michel\PaperORM\Mapping\Entity;
use Michel\PaperORM\Mapping\Column\{PrimaryKeyColumn, StringColumn, BoolColumn};

#[Entity(table: 'user')]
class User implements EntityInterface
{
    #[PrimaryKeyColumn]
    private ?int $id = null;

    #[StringColumn]
    private ?string $email = null;

    #[BoolColumn(name: 'is_active')]
    private bool $active = true;

    public function getPrimaryKeyValue(): ?int { return $this->id; }

    // getters and setters...
}
$em->persist((new User())->setEmail('[email protected]'));
$em->flush();

$users = $em->getRepository(User::class)
    ->findBy(['active' => true])
    ->orderBy('email')
    ->limit(20)
    ->toObject();            // User[]

Why PaperORM

No surprise query No lazy loading: a relation is loaded with with() or has(), in the same query. Nothing runs when you read a property.
Paginate one-to-many limit(10) returns 10 users, even when each brings 50 posts in the same join. Filter and sort on relations, the page stays right.
Your transactions flush() never opens a transaction behind your back.
Migrations as SQL paper:migration:diff writes a plain .sql file you can read; paper:migration:migrate runs it.
Small and fast About 21,000 lines of PHP with its dependencies, against about 171,000 for Doctrine ORM. Faster than or level with Doctrine on every scenario of the bundled benchmark.

What PaperORM will never do

lazy-load a relation · cascade a persist or a delete · open a transaction for you · invent a query language · query when you read a property · require a framework

Documentation

The documentation covers configuration, entities and relations, migrations, persistence, generated values, repositories, pagination, the query builder, transactions, events, the registry and the Symfony bundle.

Status

PaperORM is in alpha: the API may still change between 0.x versions. Bug reports and ideas are welcome in the issues.

License

MPL-2.0

About

PaperORM is a PHP ORM designed for projects requiring a lightweight yet performant object-relational mapping solution. Specifically developed for PHP 7.4 and above, it positions itself as a lighter alternative to existing solutions.

michelphp.github.io/paper-orm/

Resources

Readme
MPL-2.0 license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.