{"id":19198872,"url":"https://github.com/danrvp/shiptheory-php","last_synced_at":"2026-03-04T02:02:44.574Z","repository":{"id":62549694,"uuid":"484995545","full_name":"DanRVP/shiptheory-php","owner":"DanRVP","description":"Shiptheory API Client for PHP","archived":false,"fork":false,"pushed_at":"2023-05-07T13:33:30.000Z","size":195,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T16:38:47.404Z","etag":null,"topics":["api","autoload","helper","namespace","php","shiptheory","shiptheory-api"],"latest_commit_sha":null,"homepage":"https://shiptheory.com/developer/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanRVP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-24T10:28:55.000Z","updated_at":"2023-12-31T21:57:05.000Z","dependencies_parsed_at":"2024-11-09T12:26:02.008Z","dependency_job_id":"64b6b5fd-f2d2-4701-9cb7-39fa5c4379dc","html_url":"https://github.com/DanRVP/shiptheory-php","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanRVP%2Fshiptheory-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanRVP%2Fshiptheory-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanRVP%2Fshiptheory-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanRVP%2Fshiptheory-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanRVP","download_url":"https://codeload.github.com/DanRVP/shiptheory-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253172145,"owners_count":21865470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","autoload","helper","namespace","php","shiptheory","shiptheory-api"],"created_at":"2024-11-09T12:24:33.095Z","updated_at":"2026-03-04T02:02:44.545Z","avatar_url":"https://github.com/DanRVP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Shiptheory API library for PHP\n\nA Python version exists: [Shiptheory API library for Python](https://github.com/DanRVP/shiptheory-python)\n\n- To create pull requests fork this repository (Please adhere to the guidelines in the pull request template).\n- Use GitHub issues to detail any problems encountered. \n\n## Features\n- Build Shiptheory request bodies and queries with ease.\n- Dedicated methods to query each Shiptheory endpoint.\n- Automatic token authentication. Just provide your credentials and the library will keep your tokens valid for as long as you need.\n- Standardised error messaging.\n- Configuration via .env\n\n## Installation\nRequire with composer:\n```\ncomposer require dan-rogers/shiptheory-php\n```\n\n## Configuration\nThe library currently utilises a .env file to configure certain aspects of the library. \n\nIMPORTANT: It does not use any version of phpdotenv and instead uses its own custom implementation to keep it lightweight.\n\nCopy values from `.env.example` into a new or existing .env file in the root of your project.\n\nCurrently supported configuration options:\n- SHIPTHEORY_PHP_LOG_REQUESTS - (Boolean) When set to `true` requests are logged. When `false` or nonexistent requests are not logged.\n- SHIPTHEORY_PHP_SSL_VERIFY_PEER - (Boolean) When set to `true` SSL verification is enabled. When `false` or nonexistent requests do not use SSL verification.\n- SHIPTHEORY_PHP_LOG_PATH - (String) When a string is set it is used as the path to the folder where log files are generated.\n\n## Using a Shiptheory Partner Tag\n*\"If you are developing an application that will be used by more than 1 company, or an application that you intend to distribute in anyway, you must include the Shiptheory-Partner-Tag http request header in all of your requests. Please contact Shiptheory support to obtain a partner tag. There is no charge for this, tags are used to provide better support to customers and partners.\"* - API Docs\n\nIn order to add a partner tag to your API requests add it as the third argument when instantiating a new ShiptheoryClient.\n```php\n$client = new ShiptheoryClient('test@test.com', 'Password123!', 'my_partner_tag');\n```\n\n## Usage\nThe workflow is similar for all endpoints, queries and bookings. Examples exist in the file `Examples`. If you want to see all endpoint methods, then look in `src/Http/ShiptheoryClient.php`.\n\nIt is recommended that you use the objects provied to build your requests as they will result with a perfect request body every time. However, if you wish you can just provide the query parameters or the JSON body (depending on request type) as a string to the method you are calling. \n\n## Example of viewing a shipment\n```php\n$client = new ShiptheoryClient('test@test.com', 'Password123!');\n$result = $client-\u003eviewShipment('Test1234')\n```\n\n## Example of listing shipments\n```php\n$client = new ShiptheoryClient('test@test.com', 'Password123!');\n$list_fields = [\n    'channel_name' =\u003e 'Api',\n    'status' =\u003e 'Ignored',\n    'limit' =\u003e 1\n];\n$list_query = new ListShipmentQuery($list_fields);\n$params = $list_query-\u003etoQueryParams();\n$client-\u003elistShipment($params);\n```\n\n## Example of searching for shipments\n```php\n$client = new ShiptheoryClient('test@test.com', 'Password123!');\n$search_fields = [\n    'created_from' =\u003e '2022-04-01',\n    'created_to' =\u003e '2022-04-30',\n    'include_products' =\u003e 1,\n];\n$search_query = new SearchShipmentQuery($search_fields);\n$params = $search_query-\u003etoQueryParams();\n$client-\u003esearchShipment($params);\n```\n\n## Example of booking a shipment\n```php\n$client = new ShiptheoryClient('test@test.com', 'Password123!');\n//Start new shipment data object\n$shipment = new Shipment();\n$shipment-\u003esetReference('Test1234');\n$shipment-\u003esetReference2('Test5678');\n\n// Set Shipment Details\n$shipment_detail = new ShipmentDetail();\n$shipment_detail-\u003esetWeight(1);\n$shipment_detail-\u003esetParcels(1);\n$shipment_detail-\u003esetValue(1);\n$shipment_detail-\u003esetShippingPrice(2.99);\n$shipment_detail-\u003esetReference3('ORDERREF3');\n$shipment_detail-\u003esetSalesSource('My Store');\n$shipment_detail-\u003esetShipDate('2022-04-30');\n$shipment_detail-\u003esetCurrencyCode('GBP');\n\n// Set Recipient\n$reciever = new Recipient();\n$reciever-\u003esetCompany('Shiptheory');\n$reciever-\u003esetFirstname('Test');\n$reciever-\u003esetLastname('Customer');\n$reciever-\u003esetAddressLine1('Unit 4.1 Paintworks');\n$reciever-\u003esetAddressLine2('Bath Road');\n$reciever-\u003esetCity('Bristol');\n$reciever-\u003esetCountry('GB');\n$reciever-\u003esetPostcode('BS4 3EH');\n$reciever-\u003esetEmail('recipient@test.com');\n$reciever-\u003esetTelephone('01234567890');\n$reciever-\u003esetWhat3Words('///what.three.words');\n$eori = new TaxNumber('GB205672212000', AddressTaxNumberTypes::EORI);\n$vat = new TaxNumber('GB123456789', AddressTaxNumberTypes::VAT);\n$reciever-\u003esetTaxNumbers([$eori, $vat]);\n\n// Set sender\n$sender = new Sender();\n$sender-\u003esetCompany('Shiptheory');\n$sender-\u003esetFirstname('Test');\n$sender-\u003esetLastname('Shipper');\n$sender-\u003esetAddressLine1('Bristol Old Vic');\n$sender-\u003esetAddressLine2('King Street');\n$sender-\u003esetCity('Bristol');\n$sender-\u003esetCountry('GB');\n$sender-\u003esetPostcode('BS1 4ED');\n$sender-\u003esetEmail('sender@test.com');\n$sender-\u003esetTelephone('01234567890');\n\n// Set Product\n$product = new Product();\n$product-\u003esetName('My Test Product');\n$product-\u003esetSku('TestProd1');\n$product-\u003esetQty(1);\n$product-\u003esetValue(1);\n$product-\u003esetWeight(1);\n$product-\u003esetCommodityCode('8443991000');\n$product-\u003esetCommodityManucountry('PL');\n\n// Add all elements to the shipment\n$shipment-\u003esetShipmentDetail($shipment_detail);\n$shipment-\u003esetRecipient($reciever);\n$shipment-\u003esetSender($sender);\n$shipment-\u003esetProducts([$product]);\n\n// Send shipment to Shiptheory\n$data = $shipment-\u003etoJson(true);\n$result = $client-\u003ebookShipment($data);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanrvp%2Fshiptheory-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanrvp%2Fshiptheory-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanrvp%2Fshiptheory-php/lists"}