{"id":37006846,"url":"https://github.com/irfan-dahir/php-mom","last_synced_at":"2026-01-14T00:46:06.716Z","repository":{"id":56993436,"uuid":"169776572","full_name":"irfan-dahir/php-mom","owner":"irfan-dahir","description":"PHP Model Object Management","archived":false,"fork":false,"pushed_at":"2019-02-12T07:07:15.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-10T00:11:14.566Z","etag":null,"topics":["generator","helper","json","management","model","object","php","php-library","php-model","php-object","psr2","psr4","schema"],"latest_commit_sha":null,"homepage":null,"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/irfan-dahir.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":"2019-02-08T17:58:22.000Z","updated_at":"2024-05-08T09:54:21.000Z","dependencies_parsed_at":"2022-08-21T10:40:43.067Z","dependency_job_id":null,"html_url":"https://github.com/irfan-dahir/php-mom","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/irfan-dahir/php-mom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfan-dahir%2Fphp-mom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfan-dahir%2Fphp-mom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfan-dahir%2Fphp-mom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfan-dahir%2Fphp-mom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irfan-dahir","download_url":"https://codeload.github.com/irfan-dahir/php-mom/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irfan-dahir%2Fphp-mom/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["generator","helper","json","management","model","object","php","php-library","php-model","php-object","psr2","psr4","schema"],"created_at":"2026-01-14T00:46:05.971Z","updated_at":"2026-01-14T00:46:06.712Z","avatar_url":"https://github.com/irfan-dahir.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Model Object Management\n[![Version](https://img.shields.io/packagist/v/irfan-dahir/php-mom.svg?style=flat)](https://packagist.org/packages/irfan-dahir/php-mom) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/irfan-dahir/php-mom.svg)](http://isitmaintained.com/project/irfan-dahir/php-mom \"Average time to resolve an issue\") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/irfan-dahir/php-mom.svg)](http://isitmaintained.com/project/irfan-dahir/php-mom \"Average time to resolve an issue\") [![stable](https://img.shields.io/badge/PHP-^%207.1-blue.svg?style=flat)]() [![MIT License](https://img.shields.io/github/license/irfan-dahir/php-mom.svg?style=flat)](https://img.shields.io/github/license/irfan-dahir/php-mom.svg?style=flat)\n\nPHP-MOM is a stupid simple PHP Model object generator and helper.\n\n## Installation\n```composer require irfan-dahir/php-mom --no-dev```\n\n\n## Example\n\n```php\nrequire_once __DIR__ . '/vendor/autoload.php';\n\n// Create the object\n$schema = \\MOM\\Schema::create();\n\n// Create an object from JSON\n$schema = \\MOM\\Schema::fromJSON(\"[]\");\n\n// Adding Properties\n$schema-\u003eadd('prop1'); // will assign value NULL\n$schema-\u003eadd('prop1', 5); // will assign value `5`\n\n\n// PHP's default syntax\n$schema-\u003eprop1 = 5;\n\n// Bulk adding\n$schema-\u003eadd([\n    'prop2',\n    'prop3' =\u003e 5,\n    'prop4' =\u003e 3.142,\n    'prop5' =\u003e 'foo',\n    'prop_unedit' =\u003e true\n]);\n\n// Works with pre-made models/objects too\n// Only copies public properties for now\n// Anonymous properties do NOT get copied (there might be a workaround)\n$schema-\u003eadd(new class {\n    public $foo = \"bar\";\n    public $baz = false;\n});\n\n// Removing properties\n$schema-\u003eremove('prop2');\n\n// Bulk removal\n$schema-\u003eremove([\n    'prop2','prop3'\n]);\n\n// PHP's default syntax\nunset($schema-\u003eprop2, ...);\n\n// Updating Properties; aka renaming\n$schema-\u003eupdate('prop1', 'prop1_edit'); // renames `prop1` to `prop1_edit` (copies the value as well)\n\n// Bulk update\n$schema-\u003eupdate([\n    'prop5' =\u003e 'prop5_edit',\n    'prop_unedit' =\u003e 'prop_edited'\n]);\n\n\n// Helper Methods\n\n$schema-\u003etoArray(); // Model to Array\n\n$schema-\u003etoJSON(); // Model to JSON\n\n```\n\n### Running tests\n1. `composer require irfan-dahir/php-mom --dev`\n2. `composer vendor/bin/phpunit tests`\n\n### Dependencies\n- PHP 7.1+\n\n\n### Issues\nPlease create an issue for any bugs/security risks/etc","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firfan-dahir%2Fphp-mom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firfan-dahir%2Fphp-mom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firfan-dahir%2Fphp-mom/lists"}