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

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky