PHP code example of campo / laravel-shipstation
1. Go to this page and download the library: Download campo/laravel-shipstation library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
campo / laravel-shipstation example snippets
LaravelShipStation\ShipStationServiceProvider::class
php artisan vendor:publish
$shipStation->{$endpoint}->get($options = [], $endpoint = '');
$shipStation = $this->app['LaravelShipStation\ShipStation'];
// Fetch an order by orderId == 123, orderId is defined by ShipStation
$order = $shipStation->orders->get([], $endpoint = 123); // returns \stdClass
// Fetch an orderId by the orderNumber, which may be user defined
$order = $shipStation->orders->getOrderId('ORD-789'); // returns integer
$shipStation->{$endpoint}->post($options = [], $endpoint = '');
$shipStation = $this->app['LaravelShipStation\ShipStation'];
$address = new LaravelShipStation\Models\Address();
$address->name = "Joe Campo";
$address->street1 = "123 Main St";
$address->city = "Cleveland";
$address->state = "OH";
$address->postalCode = "44127";
$address->country = "US";
$address->phone = "2165555555";
$item = new LaravelShipStation\Models\OrderItem();
$item->lineItemKey = '1';
$item->sku = '580123456';
$item->name = "Awesome sweater.";
$item->quantity = '1';
$item->unitPrice = '29.99';
$item->warehouseLocation = 'Warehouse A';
$order = new LaravelShipStation\Models\Order();
$order->orderNumber = '1';
$order->orderDate = '2016-05-09';
$order->orderStatus = 'awaiting_shipment';
$order->amountPaid = '29.99';
$order->taxAmount = '0.00';
$order->shippingAmount = '0.00';
$order->internalNotes = 'A note about my order.';
$order->billTo = $address;
$order->shipTo = $address;
$order->items[] = $item;
// This will var_dump the newly created order, and order should be wrapped in an array.
var_dump($shipStation->orders->post($order, 'createorder'));
// or with the helper: $shipStation->orders->create($order); would be the same.
$shipStation->{$endpoint}->delete($resourceEndPoint);
$shipStation->orders->delete($orderId);
$shipStation->{$endpoint}->update($query = [], $resourceEndPoint);
$orderExists = $shipStation->orders->existsByOrderNumber($orderNumber) // returns bool
$count = $shipStation->orders->awaitingShipmentCount(); // returns int
$newOrder = $shipStation->orders->create($order);
$shipments = $shipStation->shipments->forOrderNumber($orderNumber);
// integer
$shipStation->getMaxAllowedRequests()
// integer
$shipStation->getRemainingRequests()
// integer
$shipStation->getSecondsUntilReset()
// boolean
$shipStation->isRateLimited()
unit
unit.xml
config/app.php
config/shipstation.php