Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Swagger Php Laravel Package

zircote/swagger-php

swagger-php generates OpenAPI 3.0/3.1/3.2 documentation from your PHP 8.2+ code using attributes (preferred) or optional Doctrine annotations. Use it via CLI or programmatically, with helpful error reporting and a full documentation site.

View on GitHub
Deep Wiki
Context7

Attributes

PHP Attributes are the preferred way to annotate your code.

::: tip Namespace Using a namespace alias simplifies typing and improves readability.

All attributes are in the OpenApi\Attributes namespace.

use OpenApi\Attributes as OA;

#[OA\Info(/*...*/)]

:::

Nesting

Similar to annotations attributes can be top level or nested. However, attributes may be put at the same level if there is no ambiguity. swagger-php will then merge attributes according to the defined rules about parent/child relationships.

Example

Nested:

    #[OA\Get(
        path: '/api/users',
        responses: [
            new OA\Response(response: 200, description: 'OK'),
            new OA\Response(response: 401, description: 'Not allowed'),
        ]
    )]
    public function users() { /* ... */ }

Not nested:

    #[OA\Get(path: '/api/users')]
    #[OA\Response(response: 200, description: 'OK')]
    #[OA\Response(response: 401, description: 'Not allowed')]
    public function users() { /* ... */ }

Depending on how much nesting there is this can make things a bit simpler and easier to read.

::: warning Top level only Automatic merging of attributes works only at the top level - in the example that would be the method users(). :::

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport