Skip to content

Commit 97a06f0

Browse files
author
Antoine Lelaisant
authored
Merge pull request #4 from KnpLabs/chore/update-root-namespace
chore: update the root namespace from Knp to KnpLabs
2 parents 095a681 + 2d7aa96 commit 97a06f0

12 files changed

+37
-33
lines changed

README.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ A PHP implementation of [JSON Schema](http://json-schema.org/). This library all
77
Install the latest version with
88

99
```bash
10-
$ composer require Knp/php-json-schema
10+
$ composer require knplabs/php-json-schema
1111
```
1212

1313
# Basic Usage
1414

15-
A JsonSchema must implements `Knp\JsonSchema\JsonSchemaInterface` (which is basically an alias for `JsonSerializable`).
15+
A JsonSchema must implements `KnpLabs\JsonSchema\JsonSchemaInterface` (which also extends `JsonSerializable`).
1616

1717
## Default JsonSchema
1818

19-
There is already a default implementation of `JsonSchemaInterface` called `Knp\JsonSchema\JsonSchema` which is an abstract class. This class provides some static methods to create some common JSON Schema scalars or objects.
19+
There is already a default implementation of `JsonSchemaInterface` called `KnpLabs\JsonSchema\JsonSchema` which is an abstract class. This class provides some static methods to create some common JSON Schema scalars or objects.
2020

2121
## Scalars
2222

2323
### `JsonSchema::string()`
2424

2525
```php
26-
use Knp\JsonSchema\JsonSchema;
26+
use KnpLabs\JsonSchema\JsonSchema;
2727

2828
$schema = JsonSchema::create(
2929
'firstName', // The name of the property
@@ -36,7 +36,7 @@ $schema = JsonSchema::create(
3636
### `JsonSchema::text()`
3737

3838
```php
39-
use Knp\JsonSchema\JsonSchema;
39+
use KnpLabs\JsonSchema\JsonSchema;
4040

4141
$schema = JsonSchema::create(
4242
'content', // The name of the property
@@ -49,7 +49,7 @@ $schema = JsonSchema::create(
4949
### `JsonSchema::integer()`
5050

5151
```php
52-
use Knp\JsonSchema\JsonSchema;
52+
use KnpLabs\JsonSchema\JsonSchema;
5353

5454
$schema = JsonSchema::create(
5555
'age', // The name of the property
@@ -62,7 +62,7 @@ $schema = JsonSchema::create(
6262
### `JsonSchema::positiveInteger()`
6363

6464
```php
65-
use Knp\JsonSchema\JsonSchema;
65+
use KnpLabs\JsonSchema\JsonSchema;
6666

6767
$schema = JsonSchema::create(
6868
'age', // The name of the property
@@ -75,7 +75,7 @@ $schema = JsonSchema::create(
7575
### `JsonSchema::number()`
7676

7777
```php
78-
use Knp\JsonSchema\JsonSchema;
78+
use KnpLabs\JsonSchema\JsonSchema;
7979

8080
$schema = JsonSchema::create(
8181
'price', // The name of the property
@@ -88,7 +88,7 @@ $schema = JsonSchema::create(
8888
### `JsonSchema::boolean()`
8989

9090
```php
91-
use Knp\JsonSchema\JsonSchema;
91+
use KnpLabs\JsonSchema\JsonSchema;
9292

9393
$schema = JsonSchema::create(
9494
'isAdult', // The name of the property
@@ -101,7 +101,7 @@ $schema = JsonSchema::create(
101101
### `JsonSchema::date()`
102102

103103
```php
104-
use Knp\JsonSchema\JsonSchema;
104+
use KnpLabs\JsonSchema\JsonSchema;
105105

106106
$schema = JsonSchema::create(
107107
'createdAt', // The name of the property
@@ -114,14 +114,14 @@ $schema = JsonSchema::create(
114114
## Enum
115115

116116
Enum is a special type of scalar which is a list of possible values.
117-
They can be created by extending the `Knp\JsonSchema\EnumSchema`:
117+
They can be created by extending the `KnpLabs\JsonSchema\EnumSchema`:
118118

119119
```php
120120
<?php
121121

122122
namespace Acme;
123123

124-
use Knp\JsonSchema\EnumSchema;
124+
use KnpLabs\JsonSchema\EnumSchema;
125125

126126
class RoleEnum extends EnumSchema
127127
{
@@ -148,15 +148,22 @@ class RoleEnum extends EnumSchema
148148

149149
## Objects
150150

151-
You can create objects schema by extending the `Knp\JsonSchema\ObjectSchema` class:
151+
You can create objects schema by extending the `KnpLabs\JsonSchema\ObjectSchema` class:
152152

153153
```php
154154
<?php
155155

156156
namespace Acme;
157157

158-
use Knp\JsonSchema\ObjectSchema;
158+
use KnpLabs\JsonSchema\ObjectSchema;
159159

160+
/**
161+
* @extends ObjectSchema<array{
162+
* firstName: string,
163+
* lastName: string,
164+
* role: string,
165+
* }>
166+
*/
160167
class PersonSchema extends ObjectSchema
161168
{
162169
public function __construct()
@@ -188,14 +195,14 @@ class PersonSchema extends ObjectSchema
188195

189196
## Collections
190197

191-
You can create collections schema by extending the `Knp\JsonSchema\CollectionSchema` class:
198+
You can create collections schema by extending the `KnpLabs\JsonSchema\CollectionSchema` class:
192199

193200
```php
194201
<?php
195202

196203
namespace Acme;
197204

198-
use Knp\JsonSchema\CollectionSchema;
205+
use KnpLabs\JsonSchema\CollectionSchema;
199206

200207
class PersonCollectionSchema extends CollectionSchema
201208
{

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {
8-
"Knp\\JsonSchema\\": "src/"
8+
"KnpLabs\\JsonSchema\\": "src/"
99
}
1010
},
1111
"authors": [

src/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

77
use Exception;
88

src/CollectionSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

77
/**
88
* @template I

src/EnumSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

77
/**
88
* @template E

src/JsonSchema.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
6-
7-
use Knp\JsonSchema\Validator\Errors;
5+
namespace KnpLabs\JsonSchema;
86

97
/**
108
* @template T of mixed

src/JsonSchemaInterface.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

77
use JsonSerializable;
8-
use Knp\JsonSchema\Validator\Errors;
98

109
/**
1110
* @template T

src/ObjectSchema.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

77
/**
88
* @template T

src/Scalar/UuidSchema.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema\Scalar;
5+
namespace KnpLabs\JsonSchema\Scalar;
66

7-
use Knp\JsonSchema\JsonSchema;
8-
use Knp\JsonSchema\JsonSchemaInterface;
7+
use KnpLabs\JsonSchema\JsonSchema;
8+
use KnpLabs\JsonSchema\JsonSchemaInterface;
99

1010
/**
1111
* @implements JsonSchemaInterface<string>

src/Validator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema;
5+
namespace KnpLabs\JsonSchema;
66

7-
use Knp\JsonSchema\Validator\Errors;
7+
use KnpLabs\JsonSchema\Validator\Errors;
88

99
interface Validator
1010
{

src/Validator/Error.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema\Validator;
5+
namespace KnpLabs\JsonSchema\Validator;
66

77
final class Error
88
{

src/Validator/Errors.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace Knp\JsonSchema\Validator;
5+
namespace KnpLabs\JsonSchema\Validator;
66

77
use ArrayIterator;
88
use Countable;

0 commit comments

Comments
 (0)