Download the PHP package lamy/laravel-sign-in-apple without Composer

On this page you can find all versions of the php package lamy/laravel-sign-in-apple. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-sign-in-apple

Laravel Sign In with Apple

[Latest Version on Packagist]

Laravel Sign In with Apple is a simple package that makes it easier to implement Apple Sign In using Laravel 12 and Socialite.

It handles Apple-specific configurations, token generation, and user data parsing to provide a smooth authentication flow.


🚀 Features


📦 Installation

You can install the package via composer:

You can add the configuration apple in config/services.php:

We also recommend using laravel/socialite and socialiteproviders/apple to automatically manage user resolution and persistence:

Add Event to AppServiceProvider.php in function boot():

⚙️ Apple Developer Configuration

1. Create an App ID

2. Create a Service ID

3. Create a Sign In with Apple Key

Place the key.pem file at the root of your Laravel project (same level as your .env)

Add the following to your .env file:

4. Final .env keys overview

You should have these keys in your .env file:

The APPLE_CLIENT_SECRET will be generated later.

5. Generate the Client Secret Token

To generate the first client secret token, run the following in artisan tinker:

Then inside tinker:

Copy the generated token and set it in your .env:

6. Routing

Add the following routes to your routes/auth.php: ⚠️ Specify the callback name as: apple-callback

7. Controller Example

Here is an example controller to handle the Apple Sign In flow:

🔐 Token Generation and Apple Authentication

generateToken()

The static method generateToken() does not require any parameters.

If you've run the installation command:

and properly set the following environment variables: APPLE_CLIENT_ID APPLE_TEAM_ID APPLE_KEY_ID

Then this method will return a string, which is your APPLE_CLIENT_SECRET — you can paste it into your .env file. ℹ️ This token is valid for 6 months. After that, you’ll need to generate a new one and update APPLE_CLIENT_SECRET again.

🔐 Decode Apple Token Authentication

decodeAppleToken(Request $request)

The static method decodeAppleToken() expects an instance of Illuminate\Http\Request as a parameter, to handle the callback from Apple.

It will: Extract the authorization code from $request->input('code') Exchange the authorization code for an access token, Verify the Apple ID token’s signature, Extract user data (ID, email, name) and return a structured object for use in your app.

✅ Returned object structure The returned object provides the following methods and properties:

⚠️ Errors are silently encapsulated in the returned object using:

You can choose to handle these errors manually.

🔒 Security notes The Apple ID token (JWT) is validated against Apple’s public key.

The method uses: firebase/php-jwt phpseclib/phpseclib

to handle cryptographic operations and ensure secure authentication.

⚠️ Handling Missing Name and Email

If a user doesn’t provide name and email during the Apple Sign In, they can: On their iPhone, go to Settings Tap on their Avatar or Name Tap Sign In with Apple Remove the app that was previously authorized

Retry the login flow; Apple will prompt for name and email only once

For more info, see: StackOverflow - Laravel Socialite Apple Sign In no user info https://stackoverflow.com/questions/78101351/laravel-socialite-apple-sign-in-no-user-info/78294921

Credits - Edouard LAMY


All versions of laravel-sign-in-apple with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
firebase/php-jwt Version ^6.11
guzzlehttp/guzzle Version ^7.10
illuminate/contracts Version ^11.0||^12.0
phpseclib/phpseclib Version ^3.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lamy/laravel-sign-in-apple contains the following files

Loading the files please wait ...