All Projects → sebdesign → laravel-sri

sebdesign / laravel-sri

Licence: MIT license
Subresource Integrity (SRI) package for Laravel

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-sri

correios-consulta
Buscar informações de serviços dos correios diretamente nos sites deles, sem utilizar api de terceiros.
Stars: ✭ 155 (+545.83%)
Mutual labels:  laravel-package
query-filter
Define filters for your Eloquent models based on your request
Stars: ✭ 20 (-16.67%)
Mutual labels:  laravel-package
laravel-vatvalidator
Package to validate a vat id via the api of the european union (vies)
Stars: ✭ 15 (-37.5%)
Mutual labels:  laravel-package
laravel-package
Laravel package template
Stars: ✭ 31 (+29.17%)
Mutual labels:  laravel-package
laravel-twig
Twig for Laravel Framework
Stars: ✭ 16 (-33.33%)
Mutual labels:  laravel-package
laravel-error-handler
Laravel 5.2/5.3 package for better exception handling.
Stars: ✭ 15 (-37.5%)
Mutual labels:  laravel-package
laravel-barion
A simple Laravel wrapper for the Barion payment API
Stars: ✭ 13 (-45.83%)
Mutual labels:  laravel-package
lost-in-translation
Uncover missing translations and localization strings in Laravel applications.
Stars: ✭ 32 (+33.33%)
Mutual labels:  laravel-package
eloquent-repository
Repository pattern for Eloquent ORM with focus in cache.
Stars: ✭ 30 (+25%)
Mutual labels:  laravel-package
canvas
Code Generators for Laravel Applications and Packages
Stars: ✭ 139 (+479.17%)
Mutual labels:  laravel-package
laravel-json-api
Integrate JSON:API resources on Laravel
Stars: ✭ 17 (-29.17%)
Mutual labels:  laravel-package
qqmap-region
腾讯位置服务中国标准行政区划数据 SDK
Stars: ✭ 22 (-8.33%)
Mutual labels:  laravel-package
response
Response HTTP package for Simfony, Laravel, Lumen and PHP 7 with standard REST API
Stars: ✭ 14 (-41.67%)
Mutual labels:  laravel-package
Laravel-Crud-Generator
A Simple Laravel Library that allows to create crud operation with a single command
Stars: ✭ 20 (-16.67%)
Mutual labels:  laravel-package
craft-elixir
Craft Plugin that allows you to use Laravel's Elixir in Craft templates
Stars: ✭ 15 (-37.5%)
Mutual labels:  laravel-elixir
super-basic-auth
🔒 A lightweight package to add basic authentication to your Laravel app.
Stars: ✭ 22 (-8.33%)
Mutual labels:  laravel-package
tall-toasts
A Toast notification library for the Laravel TALL stack. You can push notifications from the backend or frontend to render customizable toasts with almost zero footprint on the published CSS/JS 🔥🚀
Stars: ✭ 296 (+1133.33%)
Mutual labels:  laravel-package
laravel-ovh
Wrapper for OVH Object Storage integration with laravel
Stars: ✭ 30 (+25%)
Mutual labels:  laravel-package
laravel-hyperpay
Laravel package for Hyperpay payment gateway in MENA.
Stars: ✭ 14 (-41.67%)
Mutual labels:  laravel-package
laravel-crm
Free & Opensource Laravel CRM solution for SMEs and Enterprises for complete customer lifecycle management.
Stars: ✭ 927 (+3762.5%)
Mutual labels:  laravel-package

Laravel SRI

Subresource Integrity (SRI) package for Laravel

Latest Version on Packagist Software License Build Status StyleCI

Reference and generate Subresource Integrity (SRI) hashes from your Laravel Elixir asset pipeline.

Installation

You can install the package via composer:

composer require sebdesign/laravel-sri

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the service provider. If you don't use auto-discovery or you are using an older version, you must add the following:

// config/app.php
'providers' => [
    Sebdesign\SRI\SubresourceIntegrityServiceProvider::class,
];

Usage

This package is aimed to reference SRI hashes for css and js files from a sri.json file in your /public folder. In order to generate this file, see the laravel-elixir-sri repository.

To reference the generated hashes from the sri.json in your views, you may use the integrity helper function with the name of the file you are using in your elixir or asset function.

As a fallback, if the given file is not found in the sri.json, it will generate the appropriate hashes on the fly for your convenience.

// Use with elixir() function
<link
    rel="stylesheet"
    href="{{ elixir('css/app.css') }}"
    integrity="{{ integrity('css/app.css') }}"
    crossorigin="anonymous">

// Use with asset() function
<script
    src="{{ asset('js/app.js') }}"
    integrity="{{ integrity('js/app.js') }}"
    crossorigin="anonymous">
</script>

If you have set the output folder for the sri.json in a different location in your Gulpfile, you can specify its path on the config/sri.php.

// config/sri.php
'path' => '/public/assets',

You can also override the config options by passing an array as a second argument on the integrity helper function:

// Use different hash algorithm
<link
    rel="stylesheet"
    href="{{ elixir('css/app.css') }}"
    integrity="{{ integrity('css/app.css', ['algorithms' => ['sha384']]) }}"
    crossorigin="anonymous">

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].