{"id":25257517,"url":"https://github.com/czproject/assert","last_synced_at":"2025-08-12T18:07:31.314Z","repository":{"id":56960976,"uuid":"101077750","full_name":"czproject/assert","owner":"czproject","description":"Assert helper.","archived":false,"fork":false,"pushed_at":"2025-07-02T09:00:52.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-22T08:55:10.887Z","etag":null,"topics":["assert","assertions","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/czproject.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license.md","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},"funding":{"custom":"https://www.janpecha.cz/donate/"}},"created_at":"2017-08-22T15:22:30.000Z","updated_at":"2025-07-02T08:59:49.000Z","dependencies_parsed_at":"2025-02-12T06:40:24.237Z","dependency_job_id":"bcf2b648-d0d6-4bfb-ab9c-62337e6328a5","html_url":"https://github.com/czproject/assert","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/czproject/assert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fassert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fassert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fassert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fassert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/czproject","download_url":"https://codeload.github.com/czproject/assert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/czproject%2Fassert/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270109377,"owners_count":24528789,"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-08-12T02:00:09.011Z","response_time":80,"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":["assert","assertions","php"],"created_at":"2025-02-12T06:40:16.816Z","updated_at":"2025-08-12T18:07:31.283Z","avatar_url":"https://github.com/czproject.png","language":"PHP","funding_links":["https://www.janpecha.cz/donate/"],"categories":[],"sub_categories":[],"readme":"# CzProject\\Assert\n\n[![Build Status](https://github.com/czproject/assert/workflows/Build/badge.svg)](https://github.com/czproject/assert/actions)\n[![Downloads this Month](https://img.shields.io/packagist/dm/czproject/assert.svg)](https://packagist.org/packages/czproject/assert)\n[![Latest Stable Version](https://poser.pugx.org/czproject/assert/v/stable)](https://github.com/czproject/assert/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/czproject/assert/blob/master/license.md)\n\nAssert helper, throws exceptions.\n\n\u003ca href=\"https://www.janpecha.cz/donate/\"\u003e\u003cimg src=\"https://buymecoffee.intm.org/img/donate-banner.v1.svg\" alt=\"Donate\" height=\"100\"\u003e\u003c/a\u003e\n\n\n## Installation\n\n[Download a latest package](https://github.com/czproject/assert/releases) or use [Composer](http://getcomposer.org/):\n\n```\ncomposer require czproject/assert\n```\n\n`CzProject\\Assert` requires PHP 8.0 or later.\n\n\n## Usage\n\n\n``` php\nuse CzProject\\Assert\\Assert;\n\nfunction add($a, $b)\n{\n\tAssert::int($a);\n\tAssert::int($b);\n\treturn $a + $b;\n}\n```\n\n* `assert($value, $msg = NULL)` - checks if value is `TRUE`\n* `bool($value, $msg = NULL)` - checks if value is `bool`\n* `int($value, $msg = NULL)` - checks if value is `int`\n* `intOrNull($value, $msg = NULL)` - checks if value is `int|NULL`\n* `float($value, $msg = NULL)` - checks if value is `float`\n* `floatOrNull($value, $msg = NULL)` - checks if value is `float|NULL`\n* `number($value, $msg = NULL)` - checks if value is `float|int`\n* `numberOrNull($value, $msg = NULL)` - checks if value is `float|int|NULL`\n* `string($value, $msg = NULL)` - checks if value is `string`\n* `stringOrNull($value, $msg = NULL)` - checks if value is `string|NULL`\n* `type($value, $type, $msg = NULL)` - checks if value is instance of given type\n* `typeOrNull($value, $type, $msg = NULL)` - checks if value is instance of given type or `NULL`\n* `null($value, $msg = NULL)` - checks if value is `NULL`\n* `in($value, $arr, $msg = NULL)` - checks if value is in array\n* `inArray($value, $arr, $msg = NULL)` - alias for `Assert::in()`\n\n\n## PhpStan extension\n\n```neon\nservices:\n\t-\n\t\tclass: CzProject\\Assert\\Bridges\\PhpStan\\StaticMethodTypeSpecifyingExtension\n\t\ttags:\n\t\t\t- phpstan.typeSpecifier.staticMethodTypeSpecifyingExtension\n```\n\n------------------------------\n\nLicense: [New BSD License](license.md)\n\u003cbr\u003eAuthor: Jan Pecha, https://www.janpecha.cz/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczproject%2Fassert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fczproject%2Fassert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fczproject%2Fassert/lists"}