{"id":20475417,"url":"https://github.com/setnemo/autogenerated-messages","last_synced_at":"2025-04-13T12:30:25.029Z","repository":{"id":43831264,"uuid":"413750667","full_name":"setnemo/autogenerated-messages","owner":"setnemo","description":"Trait for customizing and auto-generate default messages by type for Laravel Validation","archived":false,"fork":false,"pushed_at":"2024-12-18T12:48:05.000Z","size":72,"stargazers_count":4,"open_issues_count":1,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T22:33:30.652Z","etag":null,"topics":["hacktobefest","hacktoberfest-accepted","laravel","laravel-package","laravel-validation","laravel-validation-message"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/setnemo/autogenerated-messages","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/setnemo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-10-05T09:21:31.000Z","updated_at":"2024-12-18T12:48:01.000Z","dependencies_parsed_at":"2022-09-12T10:52:05.816Z","dependency_job_id":null,"html_url":"https://github.com/setnemo/autogenerated-messages","commit_stats":{"total_commits":31,"total_committers":6,"mean_commits":5.166666666666667,"dds":0.6774193548387097,"last_synced_commit":"9a37ff963eeac9bce838ae613eca110f76845f33"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setnemo%2Fautogenerated-messages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setnemo%2Fautogenerated-messages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setnemo%2Fautogenerated-messages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setnemo%2Fautogenerated-messages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/setnemo","download_url":"https://codeload.github.com/setnemo/autogenerated-messages/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248714196,"owners_count":21149846,"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":["hacktobefest","hacktoberfest-accepted","laravel","laravel-package","laravel-validation","laravel-validation-message"],"created_at":"2024-11-15T15:15:56.980Z","updated_at":"2025-04-13T12:30:24.972Z","avatar_url":"https://github.com/setnemo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto-generated default messages for Laravel Validation\n\nThis project will help to generate automatically error messages based on your validation rules in the Laravel project.\n\n## How it works?\n\nYou install the package:\n\n```bash\ncomposer require setnemo/autogenerated-messages\n```\n\nThen, in your Request class (which inherits from FormRequest), add the trait:\n```php\n\u003c?php\ndeclare(strict_types=1);\nnamespace Awesome\\Requests;\nuse Illuminate\\Foundation\\Http\\FormRequest;\nclass NewRequest extends FormRequest\n{\n    use DefaultMessages;  /** Add use trait */\n    public function rules(): array\n    {\n        return [\n            'name' =\u003e 'required|string|max:120',\n            'start_date' =\u003e 'required|integer',\n            'price' =\u003e 'nullable|numeric|min:0 ',\n            'pay_link' =\u003e 'nullable|string|url|max:256',\n            'video' =\u003e 'nullable|mimes:mp4,mov,avi',\n            'confidentiality' =\u003e 'required|string|in:public,personal',\n        ];\n    }\n}\n```\nIt's all! Error messages will be generated based on your rules.\n\nExample:\n```php\n\u003c?php\n\nvar_export($newRequest-\u003emessage());\n```\n\nResult:\n```php\n[\n  'name.required' =\u003e 'name is required',\n  'name.string' =\u003e 'Value for name must be string',\n  'name.max' =\u003e 'Maximal value for name is 120',\n  'start_date.required' =\u003e 'start_date is required',\n  'start_date.integer' =\u003e 'Value for start_date must be integer',\n  'price.numeric' =\u003e 'Key price must be numeric',\n  'price.min' =\u003e 'Minimal value for price is 0',\n  'pay_link.string' =\u003e 'Value for pay_link must be string',\n  'pay_link.url' =\u003e 'Key pay_link must be valid url',\n  'pay_link.max' =\u003e 'Maximal value for pay_link is 256',\n  'video.mimes' =\u003e 'Allowed formats for video: mp4, mov, avi',\n  'confidentiality.required' =\u003e 'confidentiality is required',\n  'confidentiality.string' =\u003e 'Value for confidentiality must be string',\n  'confidentiality.in' =\u003e 'Allowed values for confidentiality: public, personal',\n];\n```\n\n## Supported types\n\nRight now project supported next validation types:\n\n```php\n[\n    'required',\n    'integer',\n    'numeric',\n    'string',\n    'url',\n    'in',\n    'not_in',\n    'min',\n    'max',\n    'mimes',\n    'email',\n    'unique',\n    'json',\n    'image',\n    'accepted',\n    'array',\n    'boolean',\n    'regex',\n    'exists',\n    'uuid',\n    'after',\n    'ip',\n    'ipv4',\n    'ipv6',\n    'mac_address',\n    'starts_with',\n    'ends_with',\n    'doesnt_start_with',\n    'doesnt_end_with',\n    'multiple_of',\n    'same'\n];\n```\n\nAlso, you can add another Laravel Validation types, just create fork this project and create pull request.\n\nOr add in your project:\n```php\n\u003c?php\n$this-\u003eaddRuleNames(['test_rule']);\n$this-\u003eaddRulesToMessages(['test_rule' =\u003e 'test_message']);\n```\n\n## Contributing Guide\n\n\u003e Please check [Contributing Guide](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetnemo%2Fautogenerated-messages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetnemo%2Fautogenerated-messages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetnemo%2Fautogenerated-messages/lists"}