-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from carsdotcom/initial-commit
Initial commit
- Loading branch information
Showing
40 changed files
with
11,591 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
.idea/ | ||
.ackrc | ||
|
||
# Laravel 4 specific | ||
bootstrap/compiled.php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,19 @@ | ||
# php-request-class | ||
Structure the logic around Guzzle API requests into object-oriented classes | ||
|
||
## What? | ||
We maintain an application that is reliant on dozens of REST APIs, most of which do not have SDKs. | ||
|
||
We love [Guzzle](https://github.com/guzzle/guzzle)! But most of the documentation assumes that making a request is "easy," just a few lines of code. | ||
|
||
But we've discovered in our own use that the structure around that Guzzle request can run into hundreds of lines, | ||
managing pre-requisites like authentication, converting data between our internal types and our partners' types, etc. | ||
|
||
So we created `AbstractRequest` as a standardized way to: | ||
1. Organize logic into classes. | ||
2. Provide swappable traits for encoding and decoding (XML, JSON, forms, even simplified GraphQL!) | ||
3. Log *everything* using Laravel's File facade | ||
4. Cache using Laravel's Cache facade (with a simple automatic cache key generator) | ||
5. Provide a structure for chainable prerequisites (like authentication) | ||
6. Provide a structure for catching exceptions and parsing responses back into your internal logic | ||
7. Let you defer decisions about call order or synchronous/asynchronous processing to the user of the request class |
Oops, something went wrong.