PHP code example of mustafarefaey / laravel-hybrid-spa

1. Go to this page and download the library: Download mustafarefaey/laravel-hybrid-spa library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mustafarefaey / laravel-hybrid-spa example snippets


return [
    /**
     * This should be a full HTTP/HTTPS URL to your JS app.
     * Example: 'https://example.com/app.js'
     */
    'js-app-url' => '',

    /**
     * This should be an array of full HTTP/HTTPS URLs to your stylesheets.
     * Example: ['https://example.com/app.css']
     */
    'stylesheets' => [],

    /**
     * This should be the ID of the element that mounts the JS app.
     * Example: 'app'
     */
    'js-app-id' => '',

    /**
     * This must be a full qualified class path, that implements
     * `MustafaRefaey\LaravelHybridSpa\RetrievesSharedState` interface
     */
    'shared-state-handler' => '\\MustafaRefaey\\LaravelHybridSpa\\SharedState',

    /**
     * This is the name of the global JS variable, that will be injected with the shared state
     * Example: '__SHARED_STATE__', will be exposed as `window.__SHARED_STATE__`
     */
    'shared-state-variable' => '__SHARED_STATE__',

    /**
     * This is the name of the global JS variable, that will be injected with the page state
     * Example: '__PAGE_STATE__', will be exposed as `window.__PAGE_STATE__`
     */
    'page-state-variable' => '__PAGE_STATE__',

    /**
     * This is an array of arrays, to describe favicons
     * Must be in this format:
     *  [
     *      ['href' => '', 'sizes' => '', 'type' => ''],
     *      ['href' => '', 'sizes' => '', 'type' => ''],
     *  ]
     *
     */
    'favicons' => [],
];

use MustafaRefaey\LaravelHybridSpa\ApiResponse;

return ApiResponse::success();

return ApiResponse::success(array $data = [], array $messages = [], int $code = 200);

return ApiResponse::fail();

return ApiResponse::fail(array $data = [], array $messages = [], int $code = 400);

use MustafaRefaey\LaravelHybridSpa\HybridResponse;

return HybridResponse::make(array $pageState = []);
bash
php artisan vendor:publish --provider="MustafaRefaey\LaravelHybridSpa\LaravelHybridSpaServiceProvider" --tag="config"