{"id":33957284,"url":"https://github.com/miken32/networkrules","last_synced_at":"2025-12-12T21:00:39.990Z","repository":{"id":200534900,"uuid":"700533046","full_name":"miken32/NetworkRules","owner":"miken32","description":"Laravel validation rules for checking IP addresses and networks","archived":false,"fork":false,"pushed_at":"2025-02-08T18:04:40.000Z","size":85,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-20T01:53:02.948Z","etag":null,"topics":["ip-address","ip-networking","laravel","networking","subnets","validation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miken32.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-10-04T19:10:08.000Z","updated_at":"2025-06-06T10:52:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"83da152d-e481-445d-979a-e938766c9750","html_url":"https://github.com/miken32/NetworkRules","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"e4dfda2413360457041cad714a9152eb48682159"},"previous_names":["miken32/networkrules"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/miken32/NetworkRules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miken32%2FNetworkRules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miken32%2FNetworkRules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miken32%2FNetworkRules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miken32%2FNetworkRules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miken32","download_url":"https://codeload.github.com/miken32/NetworkRules/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miken32%2FNetworkRules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27691460,"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","status":"online","status_checked_at":"2025-12-12T02:00:06.775Z","response_time":129,"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":["ip-address","ip-networking","laravel","networking","subnets","validation"],"created_at":"2025-12-12T21:00:16.826Z","updated_at":"2025-12-12T21:00:39.977Z","avatar_url":"https://github.com/miken32.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cbig\u003eA Collection of Rules\u003cbr/\u003e\nfor the \u003ci\u003eReliable Validation\u003c/i\u003e\u003c/big\u003e\u003cbr/\u003e\nof\u003cbr/\u003e\nInternet Protocol Addreſſes,\u003cbr/\u003e\nNetworks, and Subnets\u003cbr/\u003e\n\u003ci\u003ewhich the author hopes will be found uſeful to\u003c/i\u003e\u003cbr/\u003e\n\u003ci\u003e\u003cb\u003eLaravel Programmers\u003c/b\u003e \u0026c.\u003c/i\u003e\n\u003c/p\u003e\n\n## Installation\n```sh\ncomposer require miken32/network-rules\n```\n\n## Available Validation Rules\nHere is a list of the available rules and their usage.\n\n[In Network](#in_networkcidr)\u003cbr/\u003e\n[IP Or Net](#ip_or_net)\u003cbr/\u003e\n[Netv4](#netv4lowhigh)\u003cbr/\u003e\n[Netv6](#netv6lowhigh)\u003cbr/\u003e\n[Private IP](#private_ip)\u003cbr/\u003e\n[Private IPv4](#private_ipv4)\u003cbr/\u003e\n[Private IPv6](#private_ipv6)\u003cbr/\u003e\n[Private Net](#private_net)\u003cbr/\u003e\n[Routable IP or Net](#routable_ip_or_net)\u003cbr/\u003e\n[Routable IP](#routable_ip)\u003cbr/\u003e\n[Routable IPv4](#routable_ipv4)\u003cbr/\u003e\n[Routable IPv6](#routable_ipv6)\u003cbr/\u003e\n[Routable Net](#routable_netlowhigh)\u003cbr/\u003e\n[Routable Netv4](#routable_netv4lowhigh)\u003cbr/\u003e\n[Routable Netv6](#routable_netv6lowhigh)\u003cbr/\u003e\n\n### in_network:cidr,...\nThe field under validation must be an IP address within one of the given networks.\nThe networks must be given in CIDR notation, and may be either IPv4 or IPv6 networks.\n```none\n'ip4_address' =\u003e 'in_network:192.168.0.1/24',\n'some_address' =\u003e 'in_network:192.168.0.0/24,192.168.1.0/24,192.168.2.0/24',\n'ip6_address' =\u003e 'in_network:fd03:224f:a5c3:99ae::0/64'\n```\n\n### ip_or_net\nThe field under validation must be an IP address or network in CIDR notation.\nThe address or network may be either IPv4 or IPv6.\n\n### netv4:_low_,_high_\nThe field under validation must be an IPv4 network in CIDR notation.\nIf provided, the number of bits in the mask must be between `low` and `high`.\n```none\n'bounded_network'   =\u003e 'netv4:20,24',\n'unbounded_network' =\u003e 'netv4'\n```\n\n### netv6:_low_,_high_\nThe field under validation must be an IPv6 network in CIDR notation.\nIf provided, the number of bits in the mask must be between `low` and `high`.\n```none\n'bounded_network'   =\u003e 'netv6:56,64'\n'unbounded_network' =\u003e 'netv6'\n```\n\n### private_ip\nThe field under validation must be a private IPv4 or IPv6 address.\nPrivate addresses are defined as being within one of the following networks:\n* 10.0.0.0/8\n* 172.16.0.0/12\n* 192.168.0.0/16\n* fc00::/7\n\nThe following networks are considered _reserved_, not _private_.\nThey are **not** considered valid by this rule:\n* 0.0.0.0/8\n* 127.0.0.0/8\n* 169.254.0.0/16\n* 240.0.0.0/4\n* ::/128\n* ::1/128\n* 2001:10::/28\n* 2001:db8::/32\n* 3ffe::/16\n* 5f00::/8\n* fe80::/10\n\n### private_ipv4\nThe field under validation must be a private IPv4 addresses.\nThe networks considered private are described in the `private_ip` rule.\n\n### private_ipv6\nThe field under validation must be a private IPv6 addresses.\nThe networks considered private are described in the `private_ip` rule.\n\n### private_net\nThe field under validation must be a private IP network in CIDR notation.\nThe networks considered private are described in the `private_ip` rule.\n\n### routable_ip_or_net\nThe field under validation must be a globally routable IP address or network in CIDR notation.\nThis excludes all private and reserved ranges, as detailed the the `private_ip` rule.\n\n### routable_ip\nThe field under validation must be a globally routable IPv4 or IPv6 address.\nThis excludes all private and reserved ranges, as detailed the the `private_ip` rule.\n\n### routable_ipv4\nThe field under validation must be a globally routable IPv4 address.\nThis excludes all private and reserved ranges, as detailed the the `private_ip` rule.\n\n### routable_ipv6\nThe field under validation must be a globally routable IPv6 address.\nThis excludes all private and reserved ranges, as detailed the the `private_ip` rule.\n\n### routable_net:_low_,_high_\nThe field under validation must be a globally routable IP network in CIDR notation.\nThe network must not overlap any private or reserved ranges, as detailed the the `private_ip` rule.\nIf provided, the number of bits in the mask must be between `low` and `high`.\n\n### routable_netv4:_low_,_high_\nThe field under validation must be a globally routable IPv4 network in CIDR notation.\nThe network must not overlap any private or reserved ranges, as detailed the the `private_ip` rule.\nIf provided, the number of bits in the mask must be between `low` and `high`.\n\n### routable_netv6:_low_,_high_\nThe field under validation must be a globally routable IPv6 network in CIDR notation.\nThe network must not overlap any private or reserved ranges, as detailed the the `private_ip` rule.\nIf provided, the number of bits in the mask must be between `low` and `high`.\n\n## Usage\nThe included validation rules can be used either as traditional string-based validation rules\nor as instantiated classes. The following code blocks perform identical validations.\n```php\n\u003c?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\n\nclass MyFormRequest extends FormRequest\n{\n    public function rules(): array\n    {\n        return [\n\n          'address'      =\u003e ['in_network:192.168.10.0/24'], // must be an IPv4 address in the specified network\n          'subnet'       =\u003e ['netv4'], // must be an IPv4 CIDR network\n          'ipv6_subnet'  =\u003e ['netv6:48,56'], // must be an IPv6 CIDR network between 48 and 56 bits\n        ];\n    }\n}\n```\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\nuse Miken32\\Validation\\Network\\Rules;\n\nclass AnotherFormRequest extends FormRequest\n{\n    public function rules(): array\n    {\n        return [\n          'address'      =\u003e [new Rules\\InNetwork('192.168.10.0/24')], // must be an IPv4 address in the specified network\n          'subnet'       =\u003e [new Rules\\Netv4()], // must be an IPv4 CIDR network\n          'ipv6_subnet'  =\u003e [new Rules\\Netv6(48, 56)], // must be an IPv6 CIDR network between 48 and 56 bits\n        ];\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiken32%2Fnetworkrules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiken32%2Fnetworkrules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiken32%2Fnetworkrules/lists"}