{"id":37000462,"url":"https://github.com/darkdevilish/mappeador","last_synced_at":"2026-01-14T00:03:05.300Z","repository":{"id":62523621,"uuid":"42140337","full_name":"darkdevilish/mappeador","owner":"darkdevilish","description":"Custom Database ORM to perform crud with ease.","archived":false,"fork":false,"pushed_at":"2015-10-04T19:04:51.000Z","size":232,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-02T10:31:51.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darkdevilish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-08T21:36:04.000Z","updated_at":"2015-09-08T21:39:35.000Z","dependencies_parsed_at":"2022-11-02T13:47:02.473Z","dependency_job_id":null,"html_url":"https://github.com/darkdevilish/mappeador","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/darkdevilish/mappeador","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkdevilish%2Fmappeador","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkdevilish%2Fmappeador/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkdevilish%2Fmappeador/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkdevilish%2Fmappeador/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darkdevilish","download_url":"https://codeload.github.com/darkdevilish/mappeador/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darkdevilish%2Fmappeador/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406468,"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":[],"created_at":"2026-01-14T00:03:04.561Z","updated_at":"2026-01-14T00:03:05.294Z","avatar_url":"https://github.com/darkdevilish.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Mappeador by Anthony Gonzalez\n\nMappeador is a simple, flexible and easy way to perform php crud with MYSQL.\n\n# Configuration\nGo to config.php file:\n```php\ndefined('DB_SERVER') ? null : define(\"DB_SERVER\", \"your_host\");\ndefined('DB_USER')   ? null : define(\"DB_USER\", \"your_username\");\ndefined('DB_PASS')   ? null : define(\"DB_PASS\", \"your_password\");\ndefined('DB_NAME')   ? null : define(\"DB_NAME\", \"db_name\");\n```\n\n# Usage\nFirst you need to configure the initialize file depending on your file structure and require the file.\nOnce the database and the table is created you have to create class that inherits from Mapper, and create public variables for each table field.\n\nExample create and table called users with 2 fields id and name, then create the following class:\n```php\nuse mappeador\\Mapper;\n\nclass User extends Mapper {\n\n  protected static $table_name=\"users\";\n\n  public $id;\n\tpublic $name;\n\n}\n```\n\nSave function it will return true if saved:\n```php\n$john = new User();\n$john-\u003ename = \"John\";\n$john-\u003esave(); /* or */ $john-\u003ecreate();\n```\n\nSave function at instantiation with array params:\n```php\n$john = new User(array( 'name' =\u003e 'John' ));\n$john-\u003esave(); /* or */ $john-\u003ecreate();\n```\n\nFind all function returns an object array:\n```php\n$users = User::find_all();\nforeach($users as $user){\n    echo $user-\u003eid . \" | \" . $user-\u003ename;\n}\n```\n\nTo find order by you just have to pass a parameter to find_all().\nExample:\n```php\n$users = User::find_all(\"id DESC\");\n```\n\nFind by id (the parameter has to be an integer):\n```php\n$user = User::find_by_id(1);\necho $user-\u003ename;\n```\n\nFind where (will return one object if LIMIT 1):\n```php\n$find_johns = User::find_where( \"name = ?\", array(\"John\") );\n$find_john = User::find_where( \"name = ? LIMIT 1\", array('John') );\n```\n\nCount all:\n```php\nUser::count_all();\n```\n\nUpdate(first you need to find a record, it will return true if updated):\n```php\n$user = User::find_by_id(1);\n$user-\u003ename = \"John\";\n$user-\u003eupdate(); /* or */ $john-\u003esave();\n```\nDelete(you need to find record first also, and returns true if deleted):\n```php\n$user = User::find_by_id(1);\n$user-\u003ename = \"John\";\n$user-\u003edelete();\n```\n[Note: after deleted it will still be in the object, it will only be deleted from database.]\n\nFind by sql can be use directly with DatabaseObject class, Mapper or class that inherits from Mapper. If the sql doesn't need sanitazation just pass one parameter with sql otherwise pass 2 parameter the sql and an array with the bind params.\n\nExample that doesn't need sanitazation(returns object array):\n```php\nuse mappeador\\DatabaseObject;\n\n$sql = \"SELECT * FROM users\";\n$result_set = DatabaseObject::find_by_sql($sql);\n```\nExample that needs sanitazation:\n```php\nuse mappeador\\DatabaseObject;\n\n$param = array(1);\n$sql = \"SELECT * FROM users WHERE id=? LIMIT 1\";\n$result_set = DatabaseObject::find_by_sql($sql, $param);\n```\n\nMysql query:\n```php\nuse mappeador\\MySQLDatabase;\n\n$db = MySQLDatabase::getInstance();\n\n$db-\u003equery($sql);\n```\n[Dangerous: don't use if you need sanitazation.]\n\nClose connection:\n```php\nuse mappeador\\MySQLDatabase;\n\n$db = MySQLDatabase::getInstance();\nif( isset($db) ) { $db-\u003eclose_connection(); }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkdevilish%2Fmappeador","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarkdevilish%2Fmappeador","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarkdevilish%2Fmappeador/lists"}