定制 bonsaicms/serve-spa 二次开发

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

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

bonsaicms/serve-spa

最新稳定版本:1.0.1

Composer 安装命令:

composer require bonsaicms/serve-spa

包简介

Package for serving SPA (Single-Page-Application) from Laravel

README 文档

README

Introduction

The purpose of this package is to simply serve an Single-Page-Application from your Laravel backend. By 'serve' we mean to provide some content (HTML document) on the defined route as the HTTP response.

By default, this package will register route GET /spa (with name spa) and the route will serve a static SPA content from view named spa (resources/views/spa.blade.php or resources/views/spa.html etc.).

Installation

$ composer require bonsaicms/serve-spa

Configuration

You can publish the configuration file with the following command:

$ php artisan vendor:publish --tag=serve-spa

Then you can customize your config file app/config/serve-spa.php.

Default Configuration file

Notice, that you can define multiple SPAs in the serve configuration key.

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Array of Single Page Applications
    |--------------------------------------------------------------------------
    |
    | You can define multiple items here.
    |
    */

    'serve' => [

        /*
        |--------------------------------------------------------------------------
        | Example SPA
        |--------------------------------------------------------------------------
        */

        [

            /*
            |--------------------------------------------------------------------------
            | Name of the Route Serving the SPA
            |--------------------------------------------------------------------------
            */

            'routeName' => 'spa',

            /*
            |--------------------------------------------------------------------------
            | Route Configuration
            |--------------------------------------------------------------------------
            |
            | This configuration will be applied only for this SPA.
            |
            */

            'routeConfig' => [
                'prefix' => 'spa',
            ],

            /*
            |--------------------------------------------------------------------------
            | Response
            |--------------------------------------------------------------------------
            |
            | Example values:
            |
            |  - 'someViewName'
            |  - 'MyController@myMethod'
            |  - [ MyController::class, 'myMethod' ]
            |  - function () { return 'my custom response'; }
            |
            */

            'response' => 'spa',

        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Global Route Configuration
    |--------------------------------------------------------------------------
    |
    | This configuration will be applied for all defined SPAs.
    |
    */

    'globalRoutesConfig' => [
        'middleware' => 'web',
    ],
];

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-10