{"id":34279420,"url":"https://github.com/twinh/wei","last_synced_at":"2026-04-02T02:18:08.109Z","repository":{"id":2877910,"uuid":"3884105","full_name":"twinh/wei","owner":"twinh","description":"A micro-framework provided powerful and simple APIs for faster and easier PHP development.","archived":false,"fork":false,"pushed_at":"2025-05-01T15:41:50.000Z","size":28127,"stargazers_count":50,"open_issues_count":0,"forks_count":14,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-09-10T23:32:01.821Z","etag":null,"topics":["cache","database","php"],"latest_commit_sha":null,"homepage":"https://github.com/twinh/wei","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/twinh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-03-31T08:03:17.000Z","updated_at":"2025-05-01T15:41:54.000Z","dependencies_parsed_at":"2023-10-24T16:42:18.347Z","dependency_job_id":"ebf19a4c-894b-4d33-8695-6fc57c94341d","html_url":"https://github.com/twinh/wei","commit_stats":{"total_commits":8006,"total_committers":11,"mean_commits":727.8181818181819,"dds":0.2336997252060954,"last_synced_commit":"741a8c049aa86843a6d821721329f7b6028261f7"},"previous_names":[],"tags_count":87,"template":false,"template_full_name":null,"purl":"pkg:github/twinh/wei","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twinh%2Fwei","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twinh%2Fwei/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twinh%2Fwei/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twinh%2Fwei/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twinh","download_url":"https://codeload.github.com/twinh/wei/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twinh%2Fwei/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cache","database","php"],"created_at":"2025-12-16T22:28:25.475Z","updated_at":"2026-04-02T02:18:08.097Z","avatar_url":"https://github.com/twinh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wei\n\n[![Build Status](https://img.shields.io/github/checks-status/twinh/wei/main?style=flat-square)](https://travis-ci.org/twinh/wei)\n[![Coverage Status](https://img.shields.io/coveralls/twinh/wei.svg?style=flat-square)](https://coveralls.io/r/twinh/wei)\n[![Latest Stable Version](http://img.shields.io/packagist/v/wei/wei.svg?style=flat-square)](https://packagist.org/packages/wei/wei)\n[![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://www.opensource.org/licenses/MIT)\n\nWei is a micro-framework provided powerful but simple APIs for faster and easier PHP development.\n\n## Getting started\n\nStart using Wei in 3 steps, it's easier than any frameworks you've seen before!\n\n```php\n// 1. Include the wei container class\nrequire 'path/to/wei/lib/Wei.php';\n\n// 2. Create the default wei container instance\n$wei = wei([\n    // Options for wei container\n    'wei' =\u003e [\n        'debug' =\u003e true,\n        // Other options ...\n    ],\n    // Options for database\n    'db' =\u003e [\n        'driver'    =\u003e 'mysql',\n        'host'      =\u003e 'localhost',\n        'dbname'    =\u003e 'wei',\n        'charset'   =\u003e 'utf8',\n        'user'      =\u003e 'root',\n        'password'  =\u003e 'xxxxxx',\n    ],\n    // More options ...\n]);\n\n// 3. Using \"db\" object to execute SQL query\n$result = $wei-\u003edb-\u003efetch(\"SELECT 1 + 2\");\n```\n\n## Installation\n\n### Composer\n\nRun the following command to install\n\n```sh\ncomposer require wei/wei\n```\n\n### Download source code\n\n* [Stable Version](https://github.com/twinh/wei/releases/latest)\n* [Develop Version](https://github.com/twinh/wei/archive/main.zip)\n\n## Resources\n\n* [Documentation](docs/zh-CN) (Chinese, GitHub online markdown)\n* [Documentation](http://twinh.github.io/wei/) (Chinese, single HTML file)\n* [API Documentation](http://twinh.github.io/wei/apidoc/) (English)\n* [Demo](demos) (English, GitHub online markdown)\n\n## API Overview\n\n### Cache\n\n```php\n// Available cache objects\n$wei-\u003ecache;\n$wei-\u003eapcu;\n$wei-\u003earrayCache;\n$wei-\u003edbCache;\n$wei-\u003efileCache;\n$wei-\u003ememcache;\n$wei-\u003ememcached;\n$wei-\u003emongoCache;\n$wei-\u003eredis;\n$wei-\u003enullCache;\n\n$cache = $wei-\u003ememcached;\n\n// Cache APIs\n$cache-\u003eget('key');\n$cache-\u003eset('key', 'value', 60);\n$cache-\u003edelete('key');\n$cache-\u003ehas('key');\n$cache-\u003eadd('key', 'value');\n$cache-\u003ereplace('key', 'value');\n$cache-\u003eincr('key', 1);\n$cache-\u003edecr('key', 1);\n$cache-\u003egetMultiple(array('key', 'key2'));\n$cache-\u003esetMultiple(array('key' =\u003e 'value', 'key2' =\u003e 'value2'));\n$cache-\u003eclear();\n\n// ...\n```\n\n### Database\n\n```php\n$db = $wei-\u003edb;\n\n// Basic CRUD and Active Recrod support\n$db-\u003equery();\n$db-\u003einsert();\n$db-\u003eupdate();\n$db-\u003edelete();\n$db-\u003eselect();\n$db-\u003eselectAll();\n$db-\u003efetch();\n$db-\u003efetchAll();\n$db-\u003efetchColumn();\n$db-\u003efind();\n$db-\u003efindOne();\n$db-\u003efindAll();\n$db-\u003eexecute();\n\n// Using query builder to build SQL\n$record = $db('table');\n\n$record\n    -\u003eselect()\n    -\u003eaddSelect()\n    -\u003eupdate()\n    -\u003edelete()\n    -\u003efrom()\n    -\u003ewhere()\n    -\u003eandWhere()\n    -\u003eorWhere()\n    -\u003egroupBy()\n    -\u003eaddGroupBy()\n    -\u003ehaving()\n    -\u003eandHaving()\n    -\u003eorHaving()\n    -\u003eorderBy()\n    -\u003eaddOrderBy()\n    -\u003eoffset()\n    -\u003elimit()\n    -\u003epage()\n    -\u003eindexBy();\n\n$record-\u003efind();\n$record-\u003efindAll();\n$record-\u003efetch();\n$record-\u003efetchAll();\n$record-\u003efetchColumn();\n$record-\u003ecount();\n$record-\u003eexecute();\n$record-\u003egetSql();\n\n// ...\n```\n\n### Validator\n\n```php\n// Available validator objects\n\n// Data type and composition\n$wei-\u003eisAlnum($input);\n$wei-\u003eisAlpha($input);\n$wei-\u003eisBlank($input);\n$wei-\u003eisDecimal($input);\n$wei-\u003eisDigit($input);\n$wei-\u003eisDivisibleBy($input);\n$wei-\u003eisDoubleByte($input);\n$wei-\u003eisEmpty($input);\n$wei-\u003eisEndsWith($input);\n$wei-\u003eisIn($input);\n$wei-\u003eisLowercase($input);\n$wei-\u003eisNull($input);\n$wei-\u003eisNumber($input);\n$wei-\u003eisRegex($input);\n$wei-\u003eisRequired($input);\n$wei-\u003eisStartsWith($input);\n$wei-\u003eisType($input);\n$wei-\u003eisUppercase($input);\n\n// Length\n$wei-\u003eisLength($input);\n$wei-\u003eisCharLength($input);\n$wei-\u003eisMaxLength($input);\n$wei-\u003eisMinLength($input);\n\n// Comparison\n$wei-\u003eisEqualTo($input);\n$wei-\u003eisIdenticalTo($input);\n$wei-\u003eisGreaterThan($input);\n$wei-\u003eisGreaterThanOrEqual($input);\n$wei-\u003eisLessThan($input);\n$wei-\u003eisLessThanOrEqual($input);\n$wei-\u003eisBetween($input);\n\n// Date and time\n$wei-\u003eisDate($input);\n$wei-\u003eisDateTime($input);\n$wei-\u003eisTime($input);\n\n// File and directory\n$wei-\u003eisDir($input);\n$wei-\u003eisExists($input);\n$wei-\u003eisFile($input);\n$wei-\u003eisImage($input);\n\n// Network\n$wei-\u003eisEmail($input);\n$wei-\u003eisIp($input);\n$wei-\u003eisTld($input);\n$wei-\u003eisUrl($input);\n$wei-\u003eisUuid($input);\n\n// Region: All\n$wei-\u003eisCreditCard($input);\n\n// Region: Chinese\n$wei-\u003eisChinese($input);\n$wei-\u003eisIdCardCn($input);\n$wei-\u003eisIdCardHk($input);\n$wei-\u003eisIdCardMo($input);\n$wei-\u003eisIdCardTw($input);\n$wei-\u003eisPhoneCn($input);\n$wei-\u003eisPostcodeCn($input);\n$wei-\u003eisQQ($input);\n$wei-\u003eisMobileCn($input);\n\n// Group\n$wei-\u003eisAllOf($input);\n$wei-\u003eisNoneOf($input);\n$wei-\u003eisOneOf($input);\n$wei-\u003eisSomeOf($input);\n\n// Others\n$wei-\u003eisAll($input);\n$wei-\u003eisCallback($input);\n$wei-\u003eisColor($input);\n\n// Validate and get error message\nif (!$wei-\u003eisDigit('abc')) {\n    print_r($wei-\u003eisDigit-\u003egetMessages());\n}\n\n// ...\n```\n\n### [More](docs/zh-CN#api)\n\n```php\n$wei-\u003erequest;\n$wei-\u003ecookie;\n$wei-\u003esession;\n$wei-\u003eua;\n$wei-\u003eupload;\n$wei-\u003eresponse;\n$wei-\u003ee;\n$wei-\u003elogger;\n$wei-\u003ecall;\n$wei-\u003eenv;\n$wei-\u003eerror;\n\n// ...\n```\n\n## Testing\n\nTo run the tests:\n\n```sh\n$ phpunit\n```\n\n## License\n\nWei is an open-source project released MIT license. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwinh%2Fwei","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwinh%2Fwei","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwinh%2Fwei/lists"}