PHPackages                             italia/spid-laravel - 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. italia/spid-laravel

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

italia/spid-laravel
===================

Laravel Package for SPID authentication

v2.1.0-beta(5mo ago)527.4k↑25%21[7 issues](https://github.com/italia/spid-laravel/issues)[13 PRs](https://github.com/italia/spid-laravel/pulls)1BSD-3-ClausePHPPHP ^8.2|^8.3CI passing

Since Feb 1Pushed 2mo ago11 watchersCompare

[ Source](https://github.com/italia/spid-laravel)[ Packagist](https://packagist.org/packages/italia/spid-laravel)[ Docs](https://github.com/italia/spid-laravel)[ RSS](/packages/italia-spid-laravel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (55)Used By (1)

[![Join the #spid-laravel channel](https://camo.githubusercontent.com/6a5901100df1d999ced2689ea0c3b72a304698b0eb7fd509773de49d922e2f61/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536c61636b2532306368616e6e656c2d253233737069642d2d6c61726176656c2d626c75652e7376673f6c6f676f3d736c61636b26636f6c6f72423d303036366363)](https://developersitalia.slack.com/messages/C8HCL6UDS/)[![Get invited](https://camo.githubusercontent.com/955506ee66b5ecde5aedcccbf418fc99d71eb84002d00e4027c3c5cacec369cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4e6f253230736c61636b2533462d476574253230796f7572253230696e766974652d626c75652e7376673f6c6f676f3d736c61636b26636f6c6f72423d303036366363)](https://slack.developers.italia.it/)[![SPID on forum.italia.it](https://camo.githubusercontent.com/b676484908b3b6b0c6e4ea3bef0b81a5d8f86cc563ba9866574f11a56529d80f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f466f72756d2d535049442d626c75652e7376673f636f6c6f72423d303036366363)](https://forum.italia.it/c/spid)

SPID authentication package for Laravel
=======================================

[](#spid-authentication-package-for-laravel)

[![CircleCI](https://camo.githubusercontent.com/5e17f7f191c64b784192abe1da7ff24089becb1efb1fe5d6f0e8418906199290/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f6974616c69612f737069642d6c61726176656c3f636f6c6f72423d303036366363)](https://circleci.com/gh/italia/spid-laravel)[![Codecov](https://camo.githubusercontent.com/bce8dd8f576afe2391b87c145b684babe6f31f84bf4c1e1bf5a6897fd715edf8/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6974616c69612f737069642d6c61726176656c2e7376673f636f6c6f72423d303036366363)](https://codecov.io/gh/italia/spid-laravel)[![PDS Skeleton](https://camo.githubusercontent.com/8716ce6177cb22f2cf351ad643c9f0cd7f7442cd8879e00296370356dcf738ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f636f6c6f72423d303036366363)](https://github.com/php-pds/skeleton)[![License](https://camo.githubusercontent.com/2f39fbff261706420958dd6d8dacda3e00ba36eec182a2c2f9b8b9e07804cdc3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6974616c69612f737069642d6c61726176656c2e7376673f636f6c6f72423d303036366363)](https://github.com/italia/spid-laravel/blob/master/LICENSE)

This is a package to provide a simple SPID authentication system to web applications based on [Laravel](https://www.laravel.com).

See [Changelog](CHANGELOG.md) for more informations about versions and breaking changes.

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

[](#installation)

1. Before installing this package patching must be enabled in `composer.json`. This is necessary because [this patch](https://rawgit.com/italia/spid-laravel/master/patches/php-saml-4.1.0-spid.patch)has to be applied to [onelogin/php-saml](https://github.com/onelogin/php-saml)for SPID compatibility.

    Edit your `composer.json` like this:

    ```
    ...
    "extra": {
       "enable-patching": "true"
    },
    ...
    ```

    or simply run:

    `composer config extra.enable-patching true`.

    Since this package is still in beta, `minimum-stability` option must be set to `beta` and the `prefer-stable` option must be set to `true` in `composer.json`.

    These options can be set by running:

    ```
    composer config minimum-stability beta
    composer config prefer-stable true
    ```

    ***For Windows only***

    Composer needs the [patch command](https://en.wikipedia.org/wiki/Patch_%28Unix%29) to be installed (it is not part of Windows). To enable it [install Git](https://git-scm.com/download/win) then add the C:\\Program Files\\Git\\usr\\bin folder to the system path.

    **This installation step will be removed before the first stable release of this package.**
2. Require this package with composer.

    `composer require italia/spid-laravel`
3. [Exclude the URIs](https://laravel.com/docs/10.x/csrf#csrf-excluding-uris)used by this package from CSRF protection because the the Identity Providers can't know what CSRF token include in their POST requests sent to your routes.

    In your `app/Http/Middleware/VerifyCsrfToken.php` set `'/spid/*'` as an element of the `$except` array.

    ```
