@@ -34,7 +34,8 @@ php artisan vendor:publish --tag="odds-api-config"
3434```
3535
3636### Example Usages
37- You can simply create a new Client, passing in your api key and thats it!
37+ You can simply create a new Client, passing in your api key and that's it! You can decide to bind the class in
38+ your ` AppServiceProvider ` , but if not, the client can easily be initialised in any ` __invoke ` or ` __construct `
3839``` php
3940$client = new OddsClient(config('odds-api.api_key'));
4041
@@ -45,9 +46,8 @@ $response = $client->setRegion('us')
4546return $response->json();
4647```
4748
48- This package is setup in a way that all the params you may need are functions which can be chained together on one
49- line, as they all return ` $this ` . Once you call one of the API endpoints which return a response, you can no longer call
50- these functions.
49+ This package is set up in a way that all the params you need can be built using chainable function helpers, as they all return ` $this ` .
50+ Once you call one of the API endpoints which return a response, you can no longer call these function helpers.
5151
5252** Another way to define your Client Class**
5353
@@ -60,12 +60,14 @@ $this->app->bind(OddsClient::class, function () {
6060```
6161then your class may look like
6262``` php
63+ use HandlesOddsResponse;
64+
6365public function __invoke(OddsClient $client): Response
6466{
6567 $response = $client->setRegion('us')
6668 ->getOddsForSport(SportsEnum::RUGBYLEAGUE_NRL);
6769
68- return $response->json( );
70+ return $this->extractJsonFromResponse($response );
6971}
7072```
7173
0 commit comments