You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40-2Lines changed: 40 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# php-openapi
2
2
3
-
READ[OpenAPI](https://www.openapis.org/) 3.0.x YAML and JSON files and make the content accessible in PHP objects.
3
+
Read and write[OpenAPI](https://www.openapis.org/) 3.0.x YAML and JSON files and make the content accessible in PHP objects.
4
4
5
5
It also provides a CLI tool for validating and converting OpenAPI 3.0.x YAML and JSON files.
6
6
@@ -19,7 +19,7 @@ It also provides a CLI tool for validating and converting OpenAPI 3.0.x YAML and
19
19
20
20
## Used by
21
21
22
-
This library provides a low level API for reading OpenAPI files. It is used by higher level tools to
22
+
This library provides a low level API for reading and writing OpenAPI files. It is used by higher level tools to
23
23
do awesome work:
24
24
25
25
-https://github.com/cebe/yii2-openapi Code Generator for REST API from OpenAPI spec, includes fake data generator.
@@ -105,6 +105,44 @@ foreach($openapi->paths as $path => $definition) {
105
105
Object properties are exactly like in the [OpenAPI specification](https://github.com/OAI/OpenAPI-Specification/blob/3.0.2/versions/3.0.2.md#openapi-specification).
106
106
You may also access additional properties added by specification extensions.
107
107
108
+
### Writing Specification files
109
+
110
+
```php
111
+
// create base description
112
+
$openapi = new \cebe\openapi\spec\OpenApi([
113
+
'openapi' => '3.0.2',
114
+
'info' => [
115
+
'title' => 'Test API',
116
+
'version' => '1.0.0',
117
+
],
118
+
'paths' => [],
119
+
]);
120
+
// manipulate description as needed
121
+
$openapi->paths['/test'] = new \cebe\openapi\spec\PathItem([
0 commit comments