PHPackages                             tomas-kulhanek/oauth2-shoptet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. tomas-kulhanek/oauth2-shoptet

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

tomas-kulhanek/oauth2-shoptet
=============================

Shoptet OAuth 2.0 Client Provider for The PHP League OAuth2-Client

v1.0.0(2mo ago)0274—0%MITPHPPHP &gt;=8.4CI passing

Since Feb 20Pushed 2mo agoCompare

[ Source](https://github.com/tomas-kulhanek/oauth2-shoptet)[ Packagist](https://packagist.org/packages/tomas-kulhanek/oauth2-shoptet)[ RSS](/packages/tomas-kulhanek-oauth2-shoptet/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

Shoptet OAuth 2.0 Client Provider
=================================

[](#shoptet-oauth-20-client-provider)

[![PHP Version](https://camo.githubusercontent.com/6e44ad49e5307c87d1393389feb52ab61c99956e2e5f8c77177b2501f1d3d47f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e342d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

[League OAuth2 Client](https://github.com/thephpleague/oauth2-client) provider for [Shoptet](https://www.shoptet.cz/) e-commerce platform.

Installation
------------

[](#installation)

```
composer require tomas-kulhanek/oauth2-shoptet
```

Usage
-----

[](#usage)

### Authorization Code Flow

[](#authorization-code-flow)

```
use TomasKulhanek\OAuth2\Shoptet\ShoptetProvider;

$provider = new ShoptetProvider([
    'clientId'     => 'your-client-id',
    'clientSecret' => 'your-client-secret',
    'redirectUri'  => 'https://your-app.com/callback',
    'eshopUrl'     => 'https://your-eshop.myshoptet.com',
]);

// Step 1: Redirect to authorization
$authUrl = $provider->getAuthorizationUrl();
$_SESSION['oauth2state'] = $provider->getState();
header('Location: ' . $authUrl);
exit;

// Step 2: Handle callback
if ($_GET['state'] !== $_SESSION['oauth2state']) {
    exit('Invalid state');
}

$token = $provider->getAccessToken('authorization_code', [
    'code' => $_GET['code'],
]);

// Step 3: Get resource owner
$owner = $provider->getResourceOwner($token);

echo $owner->getEmail();
echo $owner->getName();
echo $owner->getProjectId();
echo $owner->getProjectUrl();
echo $owner->getProjectName();
```

### Multi-tenant (dynamic eshop URL)

[](#multi-tenant-dynamic-eshop-url)

When each user provides their own eshop URL (e.g., from a login form):

```
$provider = new ShoptetProvider([
    'clientId'     => 'your-client-id',
    'clientSecret' => 'your-client-secret',
    'redirectUri'  => 'https://your-app.com/callback',
    'eshopUrl'     => $userProvidedEshopUrl,
]);
```

Or use `withEshopUrl()` to create a new provider instance with a different eshop URL:

```
$baseProvider = new ShoptetProvider([
    'clientId'     => 'your-client-id',
    'clientSecret' => 'your-client-secret',
    'redirectUri'  => 'https://your-app.com/callback',
]);

$provider = $baseProvider->withEshopUrl('https://specific-eshop.myshoptet.com');
```

Shoptet OAuth Endpoints
-----------------------

[](#shoptet-oauth-endpoints)

All endpoints are relative to the eshop URL:

EndpointURLAuthorization`{eshopUrl}/action/OAuthServer/authorize`Token`{eshopUrl}/action/OAuthServer/token`Resource`{eshopUrl}/action/OAuthServer/resource?method=getBasicEshop`License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance83

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

87d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7447745?v=4)[Tomáš Kulhánek](/maintainers/tomas-kulhanek)[@tomas-kulhanek](https://github.com/tomas-kulhanek)

---

Top Contributors

[![tomas-kulhanek](https://avatars.githubusercontent.com/u/7447745?v=4)](https://github.com/tomas-kulhanek "tomas-kulhanek (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tomas-kulhanek-oauth2-shoptet/health.svg)

```
[![Health](https://phpackages.com/badges/tomas-kulhanek-oauth2-shoptet/health.svg)](https://phpackages.com/packages/tomas-kulhanek-oauth2-shoptet)
```

###  Alternatives

[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
