Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Fluent msg/embed builder interface #12

Open
scrummer opened this issue Apr 12, 2022 · 0 comments
Open

[FEATURE] Fluent msg/embed builder interface #12

scrummer opened this issue Apr 12, 2022 · 0 comments

Comments

@scrummer
Copy link
Member

scrummer commented Apr 12, 2022

Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? yes

Add a fluent interface to build messages/embeds. Similar to the symfony config-definition builder.

The benefit would be that you can better see how the messages would look like when they're being sent and it makes building complex embeds easier (and cooler) I guess.

Could look something like this:

$builder = new WebhookBuilder();
$builder
    ->embeds()
        ->embed()
            ->title('embed ONE title')
            ->timestamp(new \DateTime())
            ->fields()
                ->field()
                    ->name('field title')
                    ->value('some field value')
                ->end()
            ->end()
        ->end()
        ->embed()
            ->title('embed TWO title')
            ->author()
                ->name('scrummer')
                ->iconUrl('https://my.icon.url/icon.jpg')
            ->end()
        -> end()
    ->end()
;

$builder->send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant