PHPackages                             m1guelpf/laravel-apple-login - 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. m1guelpf/laravel-apple-login

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

m1guelpf/laravel-apple-login
============================

Plug-and-play Sign in with Apple for Laravel

v1.0.1(5y ago)448242MITPHPPHP ^7.4|^8.0

Since Jan 27Pushed 5y ago3 watchersCompare

[ Source](https://github.com/m1guelpf/laravel-apple-login)[ Packagist](https://packagist.org/packages/m1guelpf/laravel-apple-login)[ Docs](https://github.com/m1guelpf/laravel-apple-login)[ GitHub Sponsors](https://github.com/m1guelpf)[ RSS](/packages/m1guelpf-laravel-apple-login/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Plug-and-play Sign in with Apple for Laravel
============================================

[](#plug-and-play-sign-in-with-apple-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/31f9ad8628a7242315f860471d05ebd8bb3c60eb46001c0bbb94607dd368ff76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d316775656c70662f6c61726176656c2d6170706c652d6c6f67696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/m1guelpf/laravel-apple-login)[![Total Downloads](https://camo.githubusercontent.com/163ea92c5862bf5319a692d764909656e92b028a91fd8040de4ee6f8d8ceb0fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d316775656c70662f6c61726176656c2d6170706c652d6c6f67696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/m1guelpf/laravel-apple-login)

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

[](#installation)

You can install the package via composer:

```
composer require m1guelpf/laravel-apple-login
```

You'll first need to create an [App ID](https://developer.apple.com/account/resources/identifiers/bundleId/add/bundle) for your website, by setting an explicit Bundle ID and enabling Sign In With Apple.

You'll then need to create a [Service ID](https://developer.apple.com/account/resources/identifiers/serviceId/add/) for your web app, and checking and configuring Sign in with Apple using the App ID created earlier and `/apple/login` as your return URL. The identifier from your Service ID will be your client id.

Finally, you'll need to create a [Private Key](https://developer.apple.com/account/resources/authkeys/add) for Sign in with Apple and your App ID. Once downloaded, use the `php artisan apple:secret path/to/key.p8` to generate a client secret.

Once you have your client id and secret, you should add them to the `config/services.php` file as follows:

```
'apple' => [
  'client_id' => env('APPLE_ID'),
  'client_secret' => env('APPLE_SECRET'),
],
```

Usage
-----

[](#usage)

To initiate the login procedure, just add a link to `/login/apple` somewhere on your login page. By default, this package will only login the user if they already had an account with the same email, but this can be customized by providing a `retrieveUser` callback on your `AuthServiceProvider`, where you can create a new user if needed:

```
use M1guelpf\LoginWithApple\LoginWithApple;

class AuthServiceProvider extends ServiceProvider
{
    public function boot()
    {
        // ...

        LoginWithApple::retrieveUserWith(function (\Laravel\Socialite\Two\User $appleUser) {
            if ($user = User::where('apple_id', $appleUser->getId())->first() || ! $appleUser->getEmail()) {
                return $user;
            }

            return User::create(['name' => $appleUser->getName(), 'email' => $appleUser->getEmail()]);
        });
    }
}
```

> Note: Due to Apple's implementation, you'll only have access to the user's name and email on their first login, and will only be able to reference them by their ID afterwards. You should structure your user retrieval code to take this limitation into account.

### Usage with Inertia.js

[](#usage-with-inertiajs)

By default, the `/login/apple` route returns a `RedirectResponse`. If you want to customize this behaviour (to return an Inertia redirect, for example), you can use the `redirectUsing` method on your `AuthServiceProvider`.

```
use Inertia\Inertia;
use M1guelpf\LoginWithApple\LoginWithApple;

class AuthServiceProvider extends ServiceProvider
{
    public function boot()
    {
        // ...

        LoginWithApple::redirectUsing(fn (string $url) => Inertia::location($url));
    }
}
```

### Manually configuring routing or migrations

[](#manually-configuring-routing-or-migrations)

By default, this package will add a nullable `apple_id` column to your users table and register its own routes (GET and POST `/login/apple`). If you wish to opt out of any of these, you can do so by calling `ignoreMigrations` or `ignoreRoutes` on your `AuthServiceProvider`.

```
use M1guelpf\LoginWithApple\LoginWithApple;

class AuthServiceProvider extends ServiceProvider
{
    public function boot()
    {
        // ...

        LoginWithApple::ignoreMigrations();
        LoginWithApple::ignoreRoutes();
    }
}
```

You can publish the migrations to your app by running `php artisan vendor:publish --tag=apple-migrations`. You can also register your own routes pointing to this package's `LoginWithAppleController` (GET `redirect()` and POST `login()`) to avoid re-implementing the backend logic.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Miguel Piedrafita](https://github.com/m1guelpf)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

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

Every ~5 days

Total

2

Last Release

1976d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23558090?v=4)[Miguel Piedrafita](/maintainers/m1guelpf)[@m1guelpf](https://github.com/m1guelpf)

---

Top Contributors

[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (4 commits)")

---

Tags

m1guelpflaravel-apple-login

### Embed Badge

![Health badge](/badges/m1guelpf-laravel-apple-login/health.svg)

```
[![Health](https://phpackages.com/badges/m1guelpf-laravel-apple-login/health.svg)](https://phpackages.com/packages/m1guelpf-laravel-apple-login)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M129](/packages/laravel-pulse)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M186](/packages/laravel-ai)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M129](/packages/roots-acorn)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

84611.1M63](/packages/php-open-source-saver-jwt-auth)

PHPackages © 2026

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