🤠 Build beautiful API integrations and SDKs with Saloon
MIT License
Bot releases are hidden (Show)
Published by Sammyjo20 over 1 year ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v2.0.0-beta4...v2.0.0-beta5
Published by Sammyjo20 over 1 year ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v2.0.0-beta3...v2.0.0-beta4
Published by Sammyjo20 over 1 year ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v2.0.0-beta2...v2.0.0-beta3
Published by Sammyjo20 over 1 year ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v2.0.0-beta1...v2.0-beta2
Published by Sammyjo20 almost 2 years ago
It's finally time for the first Saloon v2 beta! After months of work and pretty much rewriting the core code, Saloon v2 is finally in beta for you to try out. Please provide feedback on the main issue.
Issue: https://github.com/Sammyjo20/Saloon/issues/64
Docs: https://docs.saloon.dev/v/2/
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.6.0...v2.0.0-beta1
Published by Sammyjo20 almost 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.5.3...v1.6.0
Published by Sammyjo20 almost 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.5.2...v1.5.3
Published by Sammyjo20 almost 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.5.1...v1.5.2
Published by Sammyjo20 almost 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.5...v1.5.1
Published by Sammyjo20 almost 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.4.4...v1.5
Published by Sammyjo20 about 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.4.3...v1.4.4
Published by Sammyjo20 about 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.4.2...v1.4.3
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.4.1...v1.4.2
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.4.0...v1.4.1
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.3.3...v1.4.0
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.3.2...v1.3.3
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.3.1...v1.3.2
Published by Sammyjo20 over 2 years ago
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.3.0...v1.3.1
Published by Sammyjo20 over 2 years ago
Read the documentation here: https://docs.saloon.dev/advanced/oauth2-authentication
Version 1.3 introduces OAuth2 helpers/boilerplate code for the Authorization Code Flow! 🥳 It will allow you to write all the OAuth2 client configuration in a connector that you can use to:
<?php
use Sammyjo20\Saloon\Helpers\OAuth2\OAuthConfig;
use Sammyjo20\Saloon\Http\SaloonConnector;
use Sammyjo20\Saloon\Traits\OAuth2\AuthorizationCodeGrant;
class SpotifyAuthConnector extends SaloonConnector
{
use AuthorizationCodeGrant;
public function defineBaseUrl(): string
{
return 'https://accounts.spotify.com';
}
protected function defaultOauthConfig(): OAuthConfig
{
return OAuthConfig::make()
->setClientId('my-client-id')
->setClientSecret('my-client-secret')
->setDefaultScopes(['user-read-currently-playing'])
->setRedirectUri('https://my-app.saloon.dev/auth/callback')
->setAuthorizeEndpoint('authorize')
->setTokenEndpoint('token')
->setUserEndpoint('user')
}
}
$authConnector = new SpotifyAuthConnector;
// 1. Redirect the user to the authorization URL...
$authorizationUrl = $authConnector->getAuthorizationUrl($scopes, $state);
// 2. Handle the callback from the API provider and create an access token...
$authenticator = $authConnector->getAccessTokens($code, $state);
// 3. Authenticate your requests!
$request = new GetTracksRequest;
$request->withAuth($authenticator);
$request->send(); // 🚀
// 4. Refresh your access tokens...
$newAuthenticator = $authConnector->refreshAccessTokens($authenticator);
Published by Sammyjo20 over 2 years ago
Previously you could define custom methods on the connector to call requests in Saloon, like so:
protected array $requests = [
'getMyUser' => UserRequest::class,
ErrorRequest::class,
];
This was pretty limited as you couldn't define "groups" of requests.
This PR introduces an extension to this API and now you can define an array of requests, keyed for a collection or a custom "RequestCollection" which is a class that extends the base "RequestCollection" class and can have completely custom methods inside. You will also have access to the connector.
$connector->user()->get()
protected array $requests = [
'user' => [
'get' => UserRequest::class,
],
];
$connector->user()->get()
protected array $requests = [
'user' => UserCollection::class,
];
class UserCollection extends RequestCollection
{
public function get(): SaloonRequest
{
return $this->connector->request(new UserRequest);
}
}
Full Changelog: https://github.com/Sammyjo20/Saloon/compare/v1.1.0...v1.2.0