PHPackages                             onramplab/laravel-security-model - 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. [Database &amp; ORM](/categories/database)
4. /
5. onramplab/laravel-security-model

ActiveLibrary[Database &amp; ORM](/categories/database)

onramplab/laravel-security-model
================================

A Laravel package providing security for Eloquent model

v0.7.1(2y ago)013.6kMITPHPPHP &gt;=7.4

Since Feb 21Pushed 2y ago2 watchersCompare

[ Source](https://github.com/OnrampLab/laravel-security-model)[ Packagist](https://packagist.org/packages/onramplab/laravel-security-model)[ RSS](/packages/onramplab-laravel-security-model/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (11)Used By (0)

laravel-security-model
======================

[](#laravel-security-model)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![CircleCI](https://camo.githubusercontent.com/05814bc1c025f7969cceebfb502ea21815b6396f4ae1c683dd508db58cc7e74c/68747470733a2f2f636972636c6563692e636f6d2f67682f4f6e72616d704c61622f6c61726176656c2d73656375726974792d6d6f64656c2e7376673f7374796c653d736869656c64)](https://circleci.com/gh/OnrampLab/laravel-security-model)[![Total Downloads](https://camo.githubusercontent.com/2df1cdcc35de45b5cdcd6e016f01da8014f38b221dea5cd4fec237bbc0da20fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e72616d706c61622f6c61726176656c2d73656375726974792d6d6f64656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onramplab/laravel-security-model)

A Laravel package providing security for Eloquent model

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4;
- composer.

Features
--------

[](#features)

- Encryption
    - Easy to use with Laravel Eloquent model
    - Support multiple types of key management service
        - AWS KMS

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

[](#installation)

Install the package via composer

```
composer require onramplab/laravel-security-model
```

Publish migration files and run command to build tables needed in package

```
php artisan vendor:publish --tag="security-model-migrations"
php artisan migrate
```

Also, you can choose to publish the configuration file

```
php artisan vendor:publish --tag="security-model-config"
```

Usage
-----

[](#usage)

### Encryption

[](#encryption)

1. Set up credentials for key provider you want to use for encryption
2. Run command to generate a encryption key and a hash key

    ```
    php artisan security-model:generate-key
    ```
3. Use the `Securable` trait in a model
4. Implement the `Securable` interface in a model
5. Set up `$encryptable` attribute in a model to define encryptable fields. You can check out the [section](#encryptable-field-parameters) below for more info about field parameters

```
