Weave 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

Stuart Api Bundle Laravel Package

ddb/stuart-api-bundle

View on GitHub
Deep Wiki
Context7

StuartApiBundle

Simple bundle using the stuart php library to integrate with symfony

Configuration

stuart_api:
  private_key: "stuart super private key"
  public_key: "stuart public key"
  environment: "SANDBOX" // OR "PRODUCTION"
  vat_rate: 20
    authorized_webhook_ips:
      sandbox:
        - "34.254.62.41"
        - "54.194.139.211"
      production:
        - "108.128.110.19"
        - "54.171.243.90"
        - "52.51.60.65"

Functions

StuartApi

Used to create and dispatch jobs

  • public function createJobObjectFromRequest(Request $request)
  • public function createJobObject(
  • public function addJob(Job $job)

StuartApiController

These function have routes exposed and return a JSONResponse

  • nextPickupSlot($city = "Bordeaux") : Get the next available pickup slot for the city
  • validateJob(Request $request)
  • priceJob(Request $request)

Events

StuartApiEvents.php defines constants for the event names

WebhookEvent.php

This event redispatches any requests on the /webhook route. You can register an EventSubscriberInterface in your application to listen to these events and update your orders accordingly.

Only Request coming from the whitelisted ips in the configuration will be allowed through and only for the corresponding environment.

namespace App\EventSubscriber;

use DdB\StuartApiBundle\Event\StuartApiEvents;
use DdB\StuartApiBundle\Event\WebhookEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class StuartWebhookSubscriber implements EventSubscriberInterface
{
    public function onStuartApiWebhook(WebhookEvent $event)
    {
        $request = $event->getRequest();
        //Do something with the request
    }

    public static function getSubscribedEvents()
    {
        return [
           StuartApiEvents::WEBHOOK_API => 'onStuartApiWebhook',
        ];
    }
}

Translations

All the errors returned by the Stuart API can be translated using the Errors.(lang).yaml files inside Resources/translations

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator