├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── composer.json ├── config └── ticket-tailor-wrapper.php └── src ├── LaravelTicketTailorWrapper.php ├── LaravelTicketTailorWrapperFacade.php └── LaravelTicketTailorWrapperServiceProvider.php /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to `laravel-ticket-tailor-wrapper` will be documented in this file. 4 | 5 | ## 1.0.0 - 2020-12-19 6 | 7 | - initial release 8 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) Webdevhayes bvba 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel wrapper for ticket tailor. 2 | 3 | This is a laravel wrapper for [Ticket Tailor](https://tickettailor.com/). This wrapper allows you to access your Ticket Tailor data through their [Apis](https://developers.tickettailor.com/#ticket-tailor-api). 4 | 5 | ## Installation 6 | 7 | You can install the package via composer: 8 | 9 | ```bash 10 | composer require webdevhayes/laravel-ticket-tailor-wrapper 11 | ``` 12 | 13 | You can publish the config file with: 14 | ```bash 15 | php artisan vendor:publish --provider="Webdevhayes\LaravelTicketTailorWrapper\LaravelTicketTailorWrapperServiceProvider" --tag="config" 16 | ``` 17 | 18 | This is the contents of the published config file: 19 | 20 | ```php 21 | return [ 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Ticket Tailor Api Base Url 26 | |-------------------------------------------------------------------------- 27 | | 28 | | This value is the base url for the api calls. 29 | | 30 | */ 31 | 32 | "base_url" => env('TT_BASE_URL', 'https://api.tickettailor.com/v1'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Ticket Tailor Api Key 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This value is the api key for ticket tailor. This value is used when the 40 | | api is called. 41 | | 42 | */ 43 | 44 | "api_key" => env('TT_API_KEY', ''), 45 | 46 | ]; 47 | ``` 48 | 49 | ## Usage 50 | 51 | ```php 52 | $ticketTailor = new Webdevhayes\LaravelTicketTailorWrapper( config('ticket-tailor-wrapper.api_key'), config('ticket-tailor-wrapper.base_url') ); 53 | dd($ticketTailor->auth()->getAllEvents()); 54 | ``` 55 | 56 | ## TODO/POSSIBLE FEATURES 57 | * Add tests 58 | 59 | ## Changelog 60 | 61 | Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. 62 | 63 | ## Credits 64 | 65 | - [James Hayes](https://github.com/WebDevHayes) 66 | - [Spatie Laravel Package Skeleton](https://github.com/spatie/package-skeleton-laravel) 67 | 68 | ## License 69 | 70 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information. 71 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webdevhayes/laravel-ticket-tailor-wrapper", 3 | "description": "Laravel wrapper for ticket tailor.", 4 | "keywords": [ 5 | "webdevhayes", 6 | "laravel-ticket-tailor-wrapper" 7 | ], 8 | "homepage": "https://github.com/webdevhayes/laravel-ticket-tailor-wrapper", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "James Hayes", 13 | "email": "hayesj89@hotmail.co.uk", 14 | "homepage": "https://wptechgroup.com", 15 | "role": "Developer" 16 | } 17 | ], 18 | "require": { 19 | "php": "^7.4|^8.0", 20 | "illuminate/contracts": "^8.0" 21 | }, 22 | "require-dev": { 23 | "orchestra/testbench": "^6.0", 24 | "phpunit/phpunit": "^9.3" 25 | }, 26 | "autoload": { 27 | "psr-4": { 28 | "Webdevhayes\\LaravelTicketTailorWrapper\\": "src", 29 | "Webdevhayes\\LaravelTicketTailorWrapper\\Database\\Factories\\": "database/factories" 30 | } 31 | }, 32 | "autoload-dev": { 33 | "psr-4": { 34 | "Webdevhayes\\LaravelTicketTailorWrapper\\Tests\\": "tests" 35 | } 36 | }, 37 | "scripts": { 38 | "psalm": "vendor/bin/psalm", 39 | "test": "vendor/bin/phpunit --colors=always", 40 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage" 41 | }, 42 | "config": { 43 | "sort-packages": true 44 | }, 45 | "extra": { 46 | "laravel": { 47 | "providers": [ 48 | "Webdevhayes\\LaravelTicketTailorWrapper\\LaravelTicketTailorWrapperServiceProvider" 49 | ], 50 | "aliases": { 51 | "LaravelTicketTailorWrapper": "Webdevhayes\\LaravelTicketTailorWrapper\\LaravelTicketTailorWrapperFacade" 52 | } 53 | } 54 | }, 55 | "minimum-stability": "dev", 56 | "prefer-stable": true, 57 | "funding": [] 58 | } 59 | -------------------------------------------------------------------------------- /config/ticket-tailor-wrapper.php: -------------------------------------------------------------------------------- 1 | env('TT_BASE_URL', 'https://api.tickettailor.com/v1'), 15 | 16 | /* 17 | |-------------------------------------------------------------------------- 18 | | Ticket Tailor Api Key 19 | |-------------------------------------------------------------------------- 20 | | 21 | | This value is the api key for ticket tailor. This value is used when the 22 | | api is called. 23 | | 24 | */ 25 | "api_key" => env('TT_API_KEY', ''), 26 | ]; 27 | -------------------------------------------------------------------------------- /src/LaravelTicketTailorWrapper.php: -------------------------------------------------------------------------------- 1 | apiKey = $apiKey; 22 | $this->baseUrl = $baseUrl; 23 | } 24 | 25 | /** 26 | * @return $this 27 | */ 28 | public function auth() 29 | { 30 | $this->client = Http::withBasicAuth( $this->apiKey, ''); 31 | return $this; 32 | } 33 | 34 | /** 35 | * 36 | * Get all issued tickets 37 | * https://developers.tickettailor.com/#list-all-issued-tickets 38 | * 39 | * @param array $params 40 | * @return mixed 41 | */ 42 | public function getAllIssuedTickets(array $params = []) : array 43 | { 44 | $response = $this->client->get( $this->baseUrl . '/issued_tickets', $params); 45 | return $response->json(); 46 | } 47 | 48 | /** 49 | * 50 | * Get single issued ticket 51 | * https://developers.tickettailor.com/#retrieve-an-issued-ticket 52 | * 53 | * @param string $issuedTickedId 54 | * @return mixed 55 | */ 56 | public function getSingleIssuedTicket(string $issuedTickedId) : array 57 | { 58 | $response = $this->client->get( $this->baseUrl . '/issued_tickets/it_'. $issuedTickedId ); 59 | return $response->json(); 60 | } 61 | 62 | /** 63 | * 64 | * Get all events 65 | * https://developers.tickettailor.com/#list-all-events 66 | * 67 | * @param array $params 68 | * @return mixed 69 | */ 70 | public function getAllEvents(array $params = []) : array 71 | { 72 | $response = $this->client->get( $this->baseUrl . '/events', $params); 73 | return $response->json(); 74 | } 75 | 76 | /** 77 | * 78 | * Get single event 79 | * https://developers.tickettailor.com/?php#retrieve-an-event 80 | * 81 | * @param string $eventId 82 | * @return mixed 83 | */ 84 | public function getSingleEvent(string $eventId) : array 85 | { 86 | $response = $this->client->get( $this->baseUrl . '/events/ev_'. $eventId ); 87 | return $response->json(); 88 | } 89 | 90 | /** 91 | * 92 | * Get all orders 93 | * https://developers.tickettailor.com/?php#list-all-orders 94 | * 95 | * @param array $params 96 | * @return mixed 97 | */ 98 | public function getAllOrders(array $params = []) : array 99 | { 100 | $response = $this->client->get( $this->baseUrl . '/orders/', $params); 101 | return $response->json(); 102 | } 103 | 104 | /** 105 | * 106 | * Get single order 107 | * https://developers.tickettailor.com/?php#retrieve-an-order 108 | * 109 | * @param string $orderId 110 | * @return mixed 111 | */ 112 | public function getSingleOrder(string $orderId) 113 | { 114 | $response = $this->client->get( $this->baseUrl . '/orders/or_'. $orderId ); 115 | return $response->json(); 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/LaravelTicketTailorWrapperFacade.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 13 | $this->publishes([ 14 | __DIR__ . '/../config/ticket-tailor-wrapper.php' => config_path('ticket-tailor-wrapper.php'), 15 | ], 'config'); 16 | } 17 | } 18 | 19 | public function register() 20 | { 21 | $this->mergeConfigFrom(__DIR__ . '/../config/ticket-tailor-wrapper.php', 'ticket-tailor-wrapper'); 22 | } 23 | } 24 | --------------------------------------------------------------------------------