{"id":27117123,"url":"https://github.com/a904guy/php-pgos","last_synced_at":"2025-04-07T05:54:13.352Z","repository":{"id":18479997,"uuid":"21675333","full_name":"a904guy/PHP-PGOS","owner":"a904guy","description":"PHP: Persistent Generic Object Storage","archived":false,"fork":false,"pushed_at":"2017-05-01T21:03:50.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-03-24T12:20:33.461Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://hawkins.tech/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a904guy.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":"2014-07-10T01:49:11.000Z","updated_at":"2021-06-18T03:33:44.000Z","dependencies_parsed_at":"2022-09-11T20:21:45.942Z","dependency_job_id":null,"html_url":"https://github.com/a904guy/PHP-PGOS","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a904guy%2FPHP-PGOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a904guy%2FPHP-PGOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a904guy%2FPHP-PGOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a904guy%2FPHP-PGOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a904guy","download_url":"https://codeload.github.com/a904guy/PHP-PGOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601457,"owners_count":20964864,"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":[],"created_at":"2025-04-07T05:54:12.508Z","updated_at":"2025-04-07T05:54:13.338Z","avatar_url":"https://github.com/a904guy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP-PGOS\n \n## PHP: Persistent Generic Object Storage\n \n#### Modeled after [ZODB](http://www.zodb.org/en/latest/) for Python\n \n## Features\n- NoSQL Style Persistent Generic Object Storage\n- Easy to use / code, simply extend the desired adapter\n- Saves / Loads the objects dynamic data automatically\n- Manual commit object method ___save() added.\n- Extendable, contribute your own adapter easily\n- Autoloader class for adapters\n \n## Future (TODO)\n- Composer\n- Mysql, Postgres, ElasticSearch, Redis Adapters\n- Single context to __save __load methods.\n \n### Changelog\n- Added AutoClass Loader (adapter schema class PGOS_{name} : /adapter/{name}.adapter.php)\n- Added manual transaction save method ___save() for special cases when execution may fatal exit (No destructors)\n \n========= \n \n## Usage \n\n### Below is a BerkeleyDB Adapter Example\nWe welcome contributions of new adapters!\n\n### First Run\n\n```php\n\n/* Define path to a writeable area */\ndefine('BerkeleyDBm_Path', '../tmp/database.fs');\n\n/* Include Autoloader */\ninclude_once('pgos.php');\n\nclass User extends PGOS_BerkeleyDB {\n    \n    protected $id;\n    \n    /* Construct arguements must be protected or below */\n    function __construct($id)\n    {\n        $this-\u003eid = $id;\n        /* Must construct parent after all values are defined\n        that will be constant to the object */\n        parent::__construct();\n    }\n}\n\n$user = new User(1);\n\n$user-\u003ename = 'Andy Hawkins';\n$user-\u003ecompany = 'BombSquad Inc';\n$user-\u003eoccupation = 'Cylon';\n\nvar_dump($user);\n\nexit(); /* Object is stored and on next load will be available for reference */\n\n```\n\n### Output\n\n```\nobject(User)#1 (6) {\n  [\"id\":protected]=\u003e\n  int(1)\n  [\"__pgos_object_name\":\"PGOS_Interface\":private]=\u003e\n  int(1881791562)\n  [\"__pgos_object_data\":\"PGOS_Interface\":private]=\u003e\n  array(1) {\n    [\"id\"]=\u003e\n    int(1)\n  }\n  [\"__pgos_dynamic_data\":\"PGOS_Interface\":private]=\u003e\n  array(3) {\n    [\"name\"]=\u003e\n    string(12) \"Andy Hawkins\"\n    [\"company\"]=\u003e\n    string(13) \"BombSquad Inc\"\n    [\"occupation\"]=\u003e\n    string(5) \"Cylon\"\n  }\n  [\"__pgos_object_loaded\":\"PGOS_Interface\":private]=\u003e\n  bool(true)\n  [\"__pgos_object_changed\":\"PGOS_Interface\":private]=\u003e\n  bool(true)\n}\n```\n\n### Second Run\n\n```php\n\n$user = new User(1);\nvar_dump($user);\nvar_dump($user-\u003ename);\nvar_dump($user-\u003ecompany);\nvar_dump($user-\u003eoccupation);\n\nexit(); /* Not needed, just denoting execution end */\n```\n\n### Ouput\n\n```\nobject(User)#1 (6) {\n  [\"id\":protected]=\u003e\n  int(1)\n  [\"__pgos_object_name\":\"PGOS_Interface\":private]=\u003e\n  int(1881791562)\n  [\"__pgos_object_data\":\"PGOS_Interface\":private]=\u003e\n  array(1) {\n    [\"id\"]=\u003e\n    int(1)\n  }\n  [\"__pgos_dynamic_data\":\"PGOS_Interface\":private]=\u003e\n  array(3) {\n    [\"name\"]=\u003e\n    string(12) \"Andy Hawkins\"\n    [\"company\"]=\u003e\n    string(13) \"BombSquad Inc\"\n    [\"occupation\"]=\u003e\n    string(5) \"Cylon\"\n  }\n  [\"__pgos_object_loaded\":\"PGOS_Interface\":private]=\u003e\n  bool(true)\n  [\"__pgos_object_changed\":\"PGOS_Interface\":private]=\u003e\n  bool(false)\n}\nstring(12) \"Andy Hawkins\"\nstring(13) \"BombSquad Inc\"\nstring(5) \"Cylon\"\n```\n\n\n\n=========\n\n## Contributing\n\nPlease fork, add adapters, performance fixes, anything. We welcome the love.\n\nThanks,\n~@ndy\n\n### Adapter Base Example\n\nFile Schema:\n`src/adapter/{name}.adapter.php`;\n\nClass Schema\n```php\nclass PGOS_{name} extends PGOS_Interface\n{\n\n    public function __construct()\n    {\n        $this-\u003e___init();\n    }\n    \n    protected function ___save_object()\n    {\n        /* Code to save the object on destruct */\n    }\n    \n    protected function ___load_object()\n    {\n        /* Code to load object data on init */\n        $this-\u003e__pgos_object_loaded = true;\n    }\n\n}\n```\n\n=========\n\n# License\n### Creative Commons Attribution-ShareAlike 3.0 Unported\nhttp://creativecommons.org/licenses/by-sa/3.0/\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa904guy%2Fphp-pgos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa904guy%2Fphp-pgos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa904guy%2Fphp-pgos/lists"}