{"id":27858607,"url":"https://github.com/phpdevcommunity/paper-orm","last_synced_at":"2025-05-04T14:20:48.762Z","repository":{"id":289250226,"uuid":"956500883","full_name":"phpdevcommunity/paper-orm","owner":"phpdevcommunity","description":"PaperORM is a PHP ORM designed for projects requiring a lightweight yet performant object-relational mapping solution.","archived":false,"fork":false,"pushed_at":"2025-04-22T09:42:12.000Z","size":83,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T11:01:16.111Z","etag":null,"topics":["database","orm","pdo-php","sql"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpdevcommunity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-28T11:05:32.000Z","updated_at":"2025-04-22T09:42:16.000Z","dependencies_parsed_at":"2025-04-22T11:04:06.723Z","dependency_job_id":null,"html_url":"https://github.com/phpdevcommunity/paper-orm","commit_stats":null,"previous_names":["phpdevcommunity/paper-orm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fpaper-orm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fpaper-orm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fpaper-orm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdevcommunity%2Fpaper-orm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpdevcommunity","download_url":"https://codeload.github.com/phpdevcommunity/paper-orm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252345374,"owners_count":21733100,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","orm","pdo-php","sql"],"created_at":"2025-05-04T14:20:48.149Z","updated_at":"2025-05-04T14:20:48.755Z","avatar_url":"https://github.com/phpdevcommunity.png","language":"PHP","readme":"# PaperORM - A Simple and Lightweight PHP ORM\nPaperORM is a PHP ORM designed for projects requiring a lightweight yet performant object-relational mapping solution.\n\n## 📖 Documentation\n\n- [English](#english)\n- [Français](#français)\n\n## English\n\nPaperORM 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.\n\nAt just 3MB compared to Doctrine's 75MB with dependencies, PaperORM offers the essential features of a modern ORM while maintaining a minimal footprint. It includes:\n- Database schema management\n- Migration system\n- Repository pattern\n\n## Installation\n\nPaperORM is available via **Composer** and installs in seconds.\n\n### 📦 Via Composer (recommended)\n```bash\ncomposer require phpdevcommunity/paper-orm:1.0.0-alpha\n```  \n\n### 🔧 Minimal Configuration\nCreate a simple configuration file to connect PaperORM to your database:\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse PhpDevCommunity\\PaperORM\\EntityManager;\n\n// Basic configuration (MySQL, SQLite)  \n$entityManager = new EntityManager([\n            'driver' =\u003e 'sqlite',\n            'user' =\u003e null,\n            'password' =\u003e null,\n            'memory' =\u003e true,\n]);\n```\n\n✅ **PaperORM is now ready to use!**\n\n*Note: PDO and corresponding database extensions must be enabled (pdo_mysql, pdo_sqlite, etc.).*\n\n## Basic Usage\n\n### Defining an Entity\n\n```php\nuse PaperORM\\Entity\\EntityInterface;\nuse PaperORM\\Mapping\\{PrimaryKeyColumn, StringColumn, BoolColumn, DateTimeColumn, OneToMany, JoinColumn};\n\nclass User implements EntityInterface\n{\n    private ?int $id = null;\n    private string $name;\n    private string $email;\n    private bool $isActive = true;\n    private \\DateTime $createdAt;\n    \n    public static function getTableName(): string \n    {\n        return 'users';\n    }\n    \n    public static function columnsMapping(): array\n    {\n        return [\n            new PrimaryKeyColumn('id'),\n            new StringColumn('name'),\n            new StringColumn('email'),\n            new BoolColumn('isActive'),\n            new DateTimeColumn('createdAt')\n        ];\n    }\n    \n    // Getters/Setters...\n}\n```\n\n### CRUD Operations\n\n**Fetching Entities:**\n```php\n// Get user by ID\n$user = $entityManager-\u003egetRepository(User::class)-\u003efind(1);\n\n// Filtered query\n$users = $entityManager-\u003egetRepository(User::class)\n    -\u003efindBy()\n    -\u003ewhere('isActive', true)\n    -\u003eorderBy('name', 'ASC')\n    -\u003elimit(10)\n    -\u003etoArray();\n```\n\n**Insert/Update:**\n```php\n$newUser = new User();\n$newUser-\u003esetName('Jean Dupont')\n        -\u003esetEmail('jean@example.com');\n\n$entityManager-\u003epersist($newUser);\n$entityManager-\u003eflush();\n```\n\n**Delete:**\n```php\n$user = $entityManager-\u003egetRepository(User::class)-\u003efind(1);\n$entityManager-\u003eremove($user);\n$entityManager-\u003eflush();\n```\n\n### Entity Relationships\n\n```php\n// OneToMany relationship\nclass Article \n{\n    // ...\n    public static function columnsMapping(): array\n    {\n        return [\n            new OneToMany('comments', Comment::class, 'article')\n        ];\n    }\n}\n\n// Fetch with join\n$articleWithComments = $entityManager-\u003egetRepository(Article::class)\n    -\u003efind(1)\n    -\u003ewith('comments')\n    -\u003etoObject();\n```\n\n### Result Formats\n\n```php\n// Associative array\n$userArray = $repository-\u003efind(1)-\u003etoArray();\n\n// Entity object\n$userObject = $repository-\u003efind(1)-\u003etoObject();\n\n// Object collection\n$activeUsers = $repository-\u003efindBy()\n    -\u003ewhere('isActive', true)\n    -\u003etoCollection();\n```\n\n\u003e PaperORM offers a simple API while covering the essential needs of a modern ORM.\n\n## Beta Version - Contribute to Development\n\nPaperORM is currently in **beta version** and actively evolving. We invite interested developers to:\n\n### 🐞 Report Bugs\nIf you encounter issues, open a [GitHub issue](https://github.com/phpdevcommunity/paper-orm/issues) detailing:\n- Context\n- Reproduction steps\n- Expected vs. actual behavior\n\n### 💡 Suggest Improvements\nIdeas for:\n- Performance optimization\n- API improvements\n- New features\n\n### 📖 Contribute to Documentation\nComplete documentation is being written. You can:\n- Fix errors\n- Add examples\n- Translate sections\n\n**Note:** This version is stable for development use but requires additional testing for production.\n\n---\n\n*Active development continues - stay tuned for updates!*\n\n## Français\n\nPaperORM est un ORM PHP conçu pour les projets qui nécessitent une solution de mapping objet-relationnel légère et performante. Développé spécifiquement pour PHP 7.4 et versions ultérieures, il se positionne comme une alternative plus légère aux solutions existantes.\n\nAvec seulement 3Mo contre 75Mo pour Doctrine avec ses dépendances, PaperORM propose les fonctionnalités essentielles d'un ORM moderne tout en conservant une empreinte minimale. Il intègre notamment :\n- La gestion des schémas de base de données\n- Un système de migrations\n- Le pattern Repository\n\n\n## Installation\n\nPaperORM est disponible via **Composer** et s'installe en quelques secondes.\n\n### 📦 Via Composer (recommandé)\n```bash\ncomposer require phpdevcommunity/paper-orm:1.0.0-alpha\n```  \n\n### 🔧 Configuration minimale\nCréez un fichier de configuration simple pour connecter PaperORM à votre base de données :\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse PhpDevCommunity\\PaperORM\\EntityManager;\n\n// Configuration de base (MySQL, SQLite)  \n$entityManager = new EntityManager([\n            'driver' =\u003e 'sqlite',\n            'user' =\u003e null,\n            'password' =\u003e null,\n            'memory' =\u003e true,\n]);\n```\n\n✅ **PaperORM est maintenant prêt à être utilisé !**  \n\n*Remarque : PDO et les extensions correspondantes à votre SGBD doivent être activées (pdo_mysql, pdo_sqlite, etc.).*\n\n## Utilisation de base\n\n### Définition d'une entité\n\n```php\nuse PaperORM\\Entity\\EntityInterface;\nuse PaperORM\\Mapping\\{PrimaryKeyColumn, StringColumn, BoolColumn, DateTimeColumn, OneToMany, JoinColumn};\n\nclass User implements EntityInterface\n{\n    private ?int $id = null;\n    private string $name;\n    private string $email;\n    private bool $isActive = true;\n    private \\DateTime $createdAt;\n    \n    public static function getTableName(): string \n    {\n        return 'users';\n    }\n    \n    public static function columnsMapping(): array\n    {\n        return [\n            new PrimaryKeyColumn('id'),\n            new StringColumn('name'),\n            new StringColumn('email'),\n            new BoolColumn('isActive'),\n            new DateTimeColumn('createdAt')\n        ];\n    }\n    \n    // Getters/Setters...\n}\n```\n\n### Opérations CRUD\n\n**Récupération d'entités :**\n```php\n// Récupérer un utilisateur par ID\n$user = $entityManager-\u003egetRepository(User::class)-\u003efind(1);\n\n// Requête avec filtres\n$users = $entityManager-\u003egetRepository(User::class)\n    -\u003efindBy()\n    -\u003ewhere('isActive', true)\n    -\u003eorderBy('name', 'ASC')\n    -\u003elimit(10)\n    -\u003etoArray();\n```\n\n**Insertion/Mise à jour :**\n```php\n$newUser = new User();\n$newUser-\u003esetName('Jean Dupont')\n        -\u003esetEmail('jean@example.com');\n\n$entityManager-\u003epersist($newUser);\n$entityManager-\u003eflush();\n```\n\n**Suppression :**\n```php\n$user = $entityManager-\u003egetRepository(User::class)-\u003efind(1);\n$entityManager-\u003eremove($user);\n$entityManager-\u003eflush();\n```\n\n### Relations entre entités\n\n```php\n// Relation OneToMany\nclass Article \n{\n    // ...\n    public static function columnsMapping(): array\n    {\n        return [\n            new OneToMany('comments', Comment::class, 'article')\n        ];\n    }\n}\n\n// Récupération avec jointure\n$articleWithComments = $entityManager-\u003egetRepository(Article::class)\n    -\u003efind(1)\n    -\u003ewith('comments')\n    -\u003etoObject();\n```\n\n### Format des résultats\n\n```php\n// Tableau associatif\n$userArray = $repository-\u003efind(1)-\u003etoArray();\n\n// Objet entité\n$userObject = $repository-\u003efind(1)-\u003etoObject();\n\n// Collection d'objets\n$activeUsers = $repository-\u003efindBy()\n    -\u003ewhere('isActive', true)\n    -\u003etoCollection();\n```\n\n\u003e PaperORM propose une API simple tout en couvrant les besoins essentiels d'un ORM moderne.\n\n## Version Bêta - Contribuez au développement\n\nPaperORM est actuellement en **version bêta** et évolue activement. Nous invitons tous les développeurs intéressés à :\n\n### 🐞 Signaler des bugs\nSi vous rencontrez un problème, ouvrez une [issue GitHub](https://github.com/phpdevcommunity/paper-orm/issues) en détaillant :\n- Le contexte\n- Les étapes pour reproduire\n- Le comportement attendu vs. observé\n\n### 💡 Proposer des améliorations\nDes idées pour :\n- Optimiser les performances\n- Améliorer l'API\n- Ajouter des fonctionnalités\n\n### 📖 Contribuer à la documentation\nLa documentation complète est en cours de rédaction. Vous pouvez :\n- Corriger des erreurs\n- Ajouter des exemples\n- Traduire des sections\n\n**Note** : Cette version est stable pour un usage en développement, mais nécessite des tests supplémentaires pour la production.\n\n---\n\n*Le développement actif continue - restez à l'écoute pour les mises à jour !*\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevcommunity%2Fpaper-orm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpdevcommunity%2Fpaper-orm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdevcommunity%2Fpaper-orm/lists"}