We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be4f777 commit 183e8efCopy full SHA for 183e8ef
1 file changed
README.md
@@ -40,19 +40,25 @@ $ git clone https://github.com/erasys/openapi-php.git
40
41
## Usage
42
43
+Basic example:
44
+
45
```php
46
<?php
47
48
use erasys\OpenApi\Spec\v3 as OASv3;
49
50
$spec = new OASv3\Document(
- new OASv3\Info('My API', '1.0.0', '[description]', '[license]')
51
+ new OASv3\Info('My API', '1.0.0', 'My API description', 'My License')
52
);
53
-$spec->security = [
- ['api_key' => []]
54
+$rootPath = new OASv3\PathItem();
55
+$rootPath->get = new OASv3\Operation();
56
+$rootPath->get->responses = [
57
+ '200' => new OASv3\Response(['description' => 'successful response'])
58
];
59
60
+$spec->paths = ['/' => $rootPath];
61
62
$yaml = $spec->toYaml();
63
$json = $spec->toJson();
64
$arr = $spec->toArray();
0 commit comments