{"id":22203967,"url":"https://github.com/0xwal/lua-varguard","last_synced_at":"2025-03-25T02:42:45.396Z","repository":{"id":48911150,"uuid":"364129032","full_name":"0xwal/lua-varguard","owner":"0xwal","description":"Laravel-like validator.","archived":false,"fork":false,"pushed_at":"2021-12-05T13:27:04.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-30T03:43:53.367Z","etag":null,"topics":["guard","lua","validation"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/0xwal.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":"2021-05-04T03:30:46.000Z","updated_at":"2023-01-16T19:59:01.000Z","dependencies_parsed_at":"2022-08-27T02:37:52.529Z","dependency_job_id":null,"html_url":"https://github.com/0xwal/lua-varguard","commit_stats":null,"previous_names":["0xwal/lua-varguard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xwal%2Flua-varguard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xwal%2Flua-varguard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xwal%2Flua-varguard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xwal%2Flua-varguard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xwal","download_url":"https://codeload.github.com/0xwal/lua-varguard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245388750,"owners_count":20607163,"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":["guard","lua","validation"],"created_at":"2024-12-02T17:15:10.941Z","updated_at":"2025-03-25T02:42:45.376Z","avatar_url":"https://github.com/0xwal.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lua-varguard\n\nSimple API to validate input inspired by [PHP-Laravel](https://laravel.com/docs/8.x/validation) framework.\n\n## Usage\n\n```lua\nrequire('varguard')\n\nfunction rule_email(value, args)\n    -- check if not email return false\n    return false\nend\n\nlocal rules           = {\n    name                = 'required|type:string',\n    email               = 'required|type:string|email',\n    ['address.country'] = 'required',\n    ['address.city']    = 'required'\n}\n\nlocal data            = {\n    name    = 'lua',\n    email   = 'not-email',\n    address = {\n        country = 'SA',\n        -- city    = 'RY'\n    }\n}\n\nlocal validation = VarGuard(rules, data)\nlocal isValid, values = validation:validate()\n-- isValid == status of validation\nprint(validation:passes())\nprint(#validation:errors())\n```\n\n## Todo\n\n* Add more rules.\n* Support Array of Objects\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xwal%2Flua-varguard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xwal%2Flua-varguard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xwal%2Flua-varguard/lists"}