{"id":16752373,"url":"https://github.com/whizsid/arraybase","last_synced_at":"2025-04-10T15:52:29.846Z","repository":{"id":57080431,"uuid":"161219266","full_name":"whizsid/arraybase","owner":"whizsid","description":"Pure PHP SQL Like Query Language To Manipulate Arrays.","archived":false,"fork":false,"pushed_at":"2019-09-05T17:14:39.000Z","size":164,"stargazers_count":18,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T13:43:38.578Z","etag":null,"topics":["array","group","helper","join","manipulate","memory-database","php","pinned","sql","where"],"latest_commit_sha":null,"homepage":"https://whizsid.github.io/arraybase","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/whizsid.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":"2018-12-10T18:32:54.000Z","updated_at":"2024-12-13T12:25:33.000Z","dependencies_parsed_at":"2022-08-24T14:57:25.001Z","dependency_job_id":null,"html_url":"https://github.com/whizsid/arraybase","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/whizsid%2Farraybase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whizsid%2Farraybase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whizsid%2Farraybase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whizsid%2Farraybase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whizsid","download_url":"https://codeload.github.com/whizsid/arraybase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248245434,"owners_count":21071481,"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":["array","group","helper","join","manipulate","memory-database","php","pinned","sql","where"],"created_at":"2024-10-13T02:46:47.917Z","updated_at":"2025-04-10T15:52:29.821Z","avatar_url":"https://github.com/whizsid.png","language":"PHP","readme":"\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.imgur.com/Z9CFgLB.png\"\u003e\u003c/p\u003e\n\n---\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-brightgreen.svg\" alt=\"License: MIT\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/whizsid/arraybase\"\u003e\u003cimg src=\"https://img.shields.io/packagist/dt/whizsid/arraybase.svg\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/whizsid/arraybase\"\u003e\u003cimg src=\"https://img.shields.io/packagist/v/whizsid/arraybase.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://travis-ci.com/whizsid/arraybase\"\u003e\u003cimg src=\"https://travis-ci.com/whizsid/arraybase.svg?branch=master\" alt=\"Build: parsing\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.styleci.io/repos/161219266\"\u003e\u003cimg src=\"https://github.styleci.io/repos/161219266/shield\" alt=\"Style CI: parsed\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nRuntime SQL like query lanaguage for manipulate php arrays. written in pure php and not using any sql engine. Note:- this is not an any kind of query builder.\n\n## Installation\n\nYou can install arraybase on composer package manager by using below command.\n\n```\ncomposer require whizsid/arraybase\n```\n\n## Basic\n\n### Creating an ArrayBase instance\nThis is how we are creating an array base instance.\n\n```\nuse WhizSid\\ArrayBase\\AB;\n\n$ab = new AB;\n```\nArrayBase is simpler than other SQL Engines. \n\n### Creating an ArrayBase Table\n\n```\nuse WhizSid\\ArrayBase\\AB\\Table;\nuse WhizSid\\ArrayBase\\AB\\Table\\Column;\n\n$ab-\u003ecreateTable('customers',function(Table $tbl){\n    $tbl-\u003ecreateColumn('cus_id',function(Column $clmn){\n        $clmn-\u003esetType('integer')-\u003esetAutoIncrement();\n    });\n    $tbl-\u003ecreateColumn('cus_name',function(Column $clmn){\n        $clmn-\u003esetType('varchar');\n    });\n    $tbl-\u003ecreateColumn('cus_phone',function(Column $clmn){\n        $clmn-\u003esetType('varchar');\n    })\n});\n\n```\nOr with data array.\n\n```\n$ab-\u003ecreateTable('tbl_another',[\n\t[\n\t\t'c_id'=\u003e1,\n\t\t'ant_id'=\u003e\"A\"\n\t],\n\t[\n\t\t'c_id'=\u003e2,\n\t\t'ant_id'=\u003e\"B\"\n\t]\n]);\n\n```\n\n### Join Clause\n```\nuse WhizSid\\ArrayBase\\AB\\Query\\Clause\\Join;\n\n$query = $ab-\u003equery();\n\n$select = $query-\u003eselect($ab-\u003etbl_customer-\u003eas('cus'));\n\n$select-\u003ejoin($ab-\u003etbl_customer_cv-\u003eas('cv'))-\u003eon($query-\u003ecv-\u003ec_id,$query-\u003ecus-\u003ec_id);\n\n$results = $select-\u003eexecute();\n```\n\n## Where Clause\n```\n$select-\u003ewhere($query-\u003ecus-\u003ec_id,\"4567\")-\u003eand($query-\u003ecv-\u003ec_name,\"my name\");\n```\n\n## Limit\n```\n$select-\u003elimit(10,20);\n```\n\n## Order\n```\n$select-\u003eorderBy($query-\u003ecus-\u003ec_name)-\u003eorderBy($query-\u003ecus-\u003ec_address,\"desc\");\n```\n\n### Select query\n\n```\n$selectQuery = $ab-\u003equery()-\u003eselect(\n\t$ab-\u003etbl_customer,\n\t$ab::groupConcat(AB_DISTINCT,$ab-\u003etbl_facility-\u003efac_code)-\u003eas('new_sum'),\n\t$ab-\u003etbl_customer-\u003ec_id,\n\t$ab-\u003etbl_another-\u003eant_id,\n\t$ab-\u003etbl_facility-\u003efac_code\n);\n\n$selectQuery-\u003ejoin(AB_JOIN_INNER,$ab-\u003etbl_facility)-\u003eon($ab-\u003etbl_customer-\u003ec_id,'=',$ab-\u003etbl_facility-\u003ec_id);\n$selectQuery-\u003ejoin(AB_JOIN_INNER,$ab-\u003etbl_another)-\u003eon($ab-\u003etbl_customer-\u003ec_id,'=',$ab-\u003etbl_another-\u003ec_id);\n$selectQuery-\u003eorderBy($ab-\u003etbl_customer-\u003ec_id,'desc');\n$selectQuery-\u003egroupBy($ab-\u003etbl_another-\u003eant_id);\n$selectQuery-\u003ewhere($ab-\u003etbl_another-\u003eant_id,'=',\"A\");\n$selectQuery-\u003elimit(1);\n$result = $selectQuery-\u003eexecute()-\u003efetchAssoc();\n```\n\n### Update Query\n\n```\n$updateQuery = $ab-\u003equery()-\u003eupdate($ab-\u003etbl_customer)-\u003eset($ab-\u003etbl_customer-\u003ec_name,'Updated name');\n$updateQuery-\u003ewhere($ab-\u003etbl_another-\u003eant_id,\"B\");\n$updateQuery-\u003ejoin(AB_JOIN_INNER,$ab-\u003etbl_another)-\u003eon($ab-\u003etbl_another-\u003ec_id,'=',$ab-\u003etbl_customer-\u003ec_id);\n$updateQuery-\u003elimit(1);\n$updateQuery-\u003eexecute();\n```\n\n### Delete query\n\n```\n$deleteQuery = $ab-\u003equery()-\u003edelete($ab-\u003etbl_customer);\n$deleteQuery-\u003ewhere($ab-\u003etbl_another-\u003eant_id,\"B\");\n$deleteQuery-\u003ejoin(AB_JOIN_INNER,$ab-\u003etbl_another)-\u003eon($ab-\u003etbl_another-\u003ec_id,'=',$ab-\u003etbl_customer-\u003ec_id);\n$deleteQuery-\u003elimit(1);\n$deleteQuery-\u003eexecute();\n```\n\nAll Examples in the `example/index.php` file.\n\n## Goals\n\nTo bring all MySQL functions to PHP.\n\n[Read the full documentation](https://whizsid.github.io/arraybase)\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhizsid%2Farraybase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhizsid%2Farraybase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhizsid%2Farraybase/lists"}