JSON schema validation is not the same as validating JSON itself.
Assume we have JSON schema
{
"username": "string",
"age": "integer",
"friends": {
"type": "array",
"items": {
"type": "integer"
}
},
"required": ["username", "age"]
}
It describes that we want to validate object from JSON like this:
{
"username": "Alex",
"age": 30
}
So we use library like this https://github.com/justinrainbow/json-schema
that accepts JSON schema and our raw input data and we are done.
Not sure why you would require a library for JSON as PHP supports this natively, take a look at https://php.net/manual/en/book.json.php
It would help if you could describe what it is you are trying to achieve...