{"id":22688398,"url":"https://github.com/javanile/moldable","last_synced_at":"2025-04-12T21:52:23.350Z","repository":{"id":56996954,"uuid":"43810715","full_name":"javanile/moldable","owner":"javanile","description":"The only PHP \u0026 MySQL ORM for Continuous Delivery. Using javanile/moldable can eliminate the step of data migrations and schema changes, often manual steps or exceptions to a continuous delivery workflow.","archived":false,"fork":false,"pushed_at":"2021-07-21T16:10:23.000Z","size":869,"stargazers_count":41,"open_issues_count":7,"forks_count":6,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-12T21:52:19.046Z","etag":null,"topics":["continuous-delivery","continuous-integration","database","database-adapter","database-migrations","database-schema","database-schema-evolutions","migrations","mongodb","mysql","nosql","orm","schema"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javanile.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}},"created_at":"2015-10-07T11:18:54.000Z","updated_at":"2025-04-11T06:51:55.000Z","dependencies_parsed_at":"2022-08-21T11:10:17.590Z","dependency_job_id":null,"html_url":"https://github.com/javanile/moldable","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fmoldable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fmoldable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fmoldable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fmoldable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javanile","download_url":"https://codeload.github.com/javanile/moldable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637833,"owners_count":21137538,"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":["continuous-delivery","continuous-integration","database","database-adapter","database-migrations","database-schema","database-schema-evolutions","migrations","mongodb","mysql","nosql","orm","schema"],"created_at":"2024-12-10T00:14:13.997Z","updated_at":"2025-04-12T21:52:23.311Z","avatar_url":"https://github.com/javanile.png","language":"PHP","readme":"# javanile/moldable [![SensioLabsInsight](https://insight.sensiolabs.com/projects/84ccbc03-57cc-4afb-9171-eefa7052cd77/mini.png)](https://insight.sensiolabs.com/projects/84ccbc03-57cc-4afb-9171-eefa7052cd77)\n\n[![StyleCI](https://styleci.io/repos/43810715/shield?branch=master)](https://styleci.io/repos/43810715)\n[![Code Climate](https://codeclimate.com/github/javanile-bot/moldable/badges/gpa.svg)](https://codeclimate.com/github/javanile-bot/moldable)\n[![Build Status](https://travis-ci.org/javanile-bot/moldable.svg?branch=master)](https://travis-ci.org/javanile-bot/moldable)\n[![Test Coverage](https://codeclimate.com/github/javanile-bot/moldable/badges/coverage.svg)](https://codeclimate.com/github/javanile-bot/moldable/coverage)\n\nMoldable is an abstraction layer to manage MySQL database \nwith improved function to alter-state and manipulate database schema.\nMoldable integrates a ORM class for manage persistent objects and adapt database schema\n\n## Searcing for contributors :sunglasses:\nWe are looking for contributors (PHP lovers) that are passioned by ORM and Database worlds for:\n - Applying PSR code standard in working codebase and beautify the source files\n - Testing library to different framework like: Slim, Laravel, ZendFramenwork, etc...\n - Write and maintains updated the wiki sections https://github.com/javanile/moldable/wiki\n - Increase popularity of https://packagist.org/packages/javanile/moldable by different kind of promotions\n\n*We guarantee all visibility and thanks for our contributors, many many stars and public reference in all blog posts and articles that talk about javanile/moldable*\n\n## Install via composer\nWe recommend installing via composer, to install otherwise you will write a issue.\n```\ncomposer require javanile/moldable\n```\n\n## Get Started\n - [Moldable ORM](https://github.com/javanile/moldable/wiki/Moldable-ORM): Manage persistent object in your web application\n - [DB Manipulation](https://github.com/javanile/moldable/wiki/Work-with-Database): Work with Database through advanced scripting tools\n\n## How to: Connect to database\n\n```php\n\u003c?php\n// library namespace \nuse Javanile\\Moldable\\Database;\n\n// initialize a database connection object \n$db = new Database([\n    'host'     =\u003e 'localhost',\n    'dbname'   =\u003e 'db_marketing',\n    'username' =\u003e 'root',\n    'password' =\u003e 'p4ssw0rd',\n    'prefix'   =\u003e 'prefix_',\n]);\n\n// '$db' is ready to use for your manipulation\n```\n\n## How to: Create ORM class-model\n\n```php\n\u003c?php\n// library namespace \nuse Javanile\\Moldable\\Storable;\n\n// define ORM class-model\nclass Customer extends Storable \n{\n    public $id = self::PRIMARY_KEY;\n    public $name = '';\n}\n\n// instance empty object\n// database tables and fields are automatic generated \n// or updated if change Customer class\n$customer = new Customer();\n\n// assign values\n$customer-\u003ename = 'Franky Franco';\n\n// now object persist on DB\n$customer-\u003estore();\n```\n\n## How to: Create schema (update if exists) \n\n```php\n\u003c?php\n// '$db' is pre-connected database object (follow: 'How to: Connect to database')\n\n// apply method send queries to create \n// or align database to defined schema \n$db-\u003eapply([\n    // customer table name\n    'Customer' =\u003e [\t\t\n        // customer fields\n        'id'     =\u003e $db::PRIMARY_KEY,\t// define field as a primary key\n        'name'   =\u003e '',\t\t\t// empty string define field as VARCHAR\t\n        'points' =\u003e 0,\t\t\t// 0 (zero) define field as INT(11)\n        'born'   =\u003e $db::DATE,\t\t// use to define as date field\n        'bio'    =\u003e $db::TEXT,\t\t// text for large string and contents\n    ],\n    // products table name\n    'Products' =\u003e [\n        // products fields\t\t\n        'id'    =\u003e $db::PRIMARY_KEY,\t// define field as a primary key\n        'name'  =\u003e '',\t\t\t// empty string define field as VARCHAR\t\n        'price' =\u003e .0,\t\t\t// for float number init field with point-zero \".0\"\t\n    ],\n]);\n```\n## Setup for testing\nTo test the library, follow these steps:\n 1. Run a local MySQL database\n 2. Copy file `phpunit.xml.dist` to `phpunit.xml`\n 3. Update `phpunit.xml` with database connection paramiters\n 4. Run `./vendor/bin/phpunit` from project directory\n\n## Talk about\n - https://medium.com/@billmike1994/getting-started-with-moldable-an-orm-for-continuous-migration-d4be845b7c65\n - https://github.com/nazneen1/follow/wiki/Utilize-Javanile--php-tool-to-connect-any-database\n - https://www.reddit.com/r/PHP/comments/6jsm2d/the_only_php_mysql_orm_for_continuous_delivery/\n - https://www.reddit.com/r/PHP/comments/3okj7x/schemadb_a_modern_and_coincise_database/?ref=readnext_4\n - https://www.reddit.com/r/PHP/comments/427zvg/schemadb_adapt_schema_of_mysql_db_based_on_class/\n - http://fudforum.org/forum/index.php?S=Google%20%5BBot%5D\u0026t=msg\u0026th=123561\n - http://www.codingforums.com/php/374551-manipulate-database-schema.html#post1497472\n - http://forums.phpfreaks.com/topic/300920-manipulate-database-schema-with-orm/\n - http://www.giorgiotave.it/forum/php-mysql/241550-manipolare-lo-schema-del-database.html#post1205019\n - http://www.iprogrammatori.it/forum-programmazione/php/manipolare-schema-del-database-t27275.html\n - http://ctolib.com/javanile-moldable.html\n\n## Roadmap\n - Support to MongoDB for trasparent switch MySQL/MongoDB \n - Manage table to store key-value pair like Setting or Config or MetaField\n - Manage UUID field (large integer or hash string) alternative to PRIMARY_KEY index\n - Flexible join system to extend field of table model on runtime\n - Define encode/decode static method for a sub-set of field \n - Implementig Unit of work pattern\n - Listening For Query Events (gestione hook/event per modelli e query al db)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavanile%2Fmoldable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavanile%2Fmoldable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavanile%2Fmoldable/lists"}