定制 yard/brave-csp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yard/brave-csp

最新稳定版本:v1.3.0

Composer 安装命令:

composer require yard/brave-csp

包简介

Content Security Policy for Brave sites

README 文档

README

Installation

composer require yard/brave-csp

Features

This repository contains a basic Content Security Policy (CSP):

Yard\Csp\Policies\Basic::class

This Policy extends:

Spatie\Csp\Policies\Policy::class

Usage

This policy can be registered in the csp config file provided by the spatie/laravel-csp package:

<?php

declare(strict_types=1);

return [

    /*
     * A policy will determine which CSP headers will be set. A valid CSP policy is
     * any class that extends `Spatie\Csp\Policies\Policy`
     */
    'policy' => Yard\Csp\Policies\Basic::class,
    
    ...
];

It can also be extended to create a custom policy:

<?php

declare(strict_types=1);

namespace App\Csp;

use Yard\Csp\Policies\Basic;

class Policy extends Basic
{
    public function configure()
    {
        parent::configure();

        // Add site specific csp directives below
    }
}

In this case the policy config should point to this custom policy:

<?php

declare(strict_types=1);

return [

    /*
     * A policy will determine which CSP headers will be set. A valid CSP policy is
     * any class that extends `Spatie\Csp\Policies\Policy`
     */
    'policy' => App\Csp\Policy::class,

    ...
];

About us

banner

统计信息

  • 总下载量: 397
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: EUPL-1.2
  • 更新时间: 2025-12-05