Skip to content

Commit

Permalink
Added docsify-code-inline plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
d-miles committed Aug 19, 2024
1 parent eade944 commit cd85cc2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 10 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Each of these methods has the following signature:
function (string $path, callable $callbackFn)
```

Alternatively, you could also use [`addRoute()`](phpdoc/#serveraddroute) to add a route for a specific HTTP method, or omit the `$method` argument altogether to add a route for _all_ HTTP methods:
Alternatively, you could also use [`addRoute()`](phpdoc/#serveraddroute) to add a route for a specific HTTP method, or omit the [`$method` php] argument altogether to add a route for _all_ HTTP methods:
```php
function addRoute(string $path, callable $callbackFn, string $method = '_all_')
```
Expand All @@ -85,8 +85,7 @@ With automatic endpoint generation, you can supply a PHP class that contains end

Function names will be converted from camel-case to dash-case. eg. `getFooBar()` will be converted to `/foo-bar`.

You can also bind a function to a route other than the function name. Simply use the `@url` PHPDoc annotation to define the route.
For example, `@url /foo-bar` will bind the function to the same route as `getFooBar()`.
You can also bind a function to a route other than the function name. Simply use the `@url` PHPDoc annotation to define the route. For example, `@url /foo-bar` will bind the function to the same route as `getFooBar()` would.

<!-- div:right-panel -->

Expand Down Expand Up @@ -263,10 +262,9 @@ Server::create('test')

#### Custom Response Formatters

You can also define your own response formatters using the [`setCustomFormat()`](phpdoc/#clientsetcustomformat) method along with the [`setFormat()`](phpdoc/#clientsetformat) method. The formatting function will be called with a single argument, an associative array of the response data.
You can also define your own response formatters using the [`setCustomFormat()`](phpdoc/#clientsetcustomformat) method along with the [`setFormat()`](phpdoc/#clientsetformat) method. The response formatting function will be called with a single argument, [`$message` php], which is an associative array representing the response data to be serialized:

For example:
```
```php
[
'status' => 'success',
'data' => 'Hello World!'
Expand Down Expand Up @@ -484,9 +482,9 @@ throw new \Exception('My custom error');
#### Example Response
```json
{
"status": 500,
"error": "Exception",
"message": "My custom error"
"status": 500,
"error": "Exception",
"message": "My custom error"
}
```

Expand All @@ -505,9 +503,9 @@ throw new \InvalidArgumentException('Another error', 123);
#### Example Response
```json
{
"status": 123,
"error": "InvalidArgumentException",
"message": "Another error"
"status": 123,
"error": "InvalidArgumentException",
"message": "Another error"
}
```

Expand Down
1 change: 1 addition & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<script src="https://unpkg.com/docsify-copy-code@2"></script>
<script src="https://unpkg.com/docsify-tabs@1"></script>
<script src="https://unpkg.com/docsify-example-panels@1"></script>
<script src="https://unpkg.com/@rakutentech/docsify-code-inline@1"></script>
<script src="https://unpkg.com/prismjs/components/prism-json.min.js"></script>
<script src="https://unpkg.com/prismjs/components/prism-php.min.js"></script>
<script src="https://unpkg.com/prismjs/components/prism-apacheconf.min.js"></script>
Expand Down

0 comments on commit cd85cc2

Please # to comment.