All Projects â†’ coderello â†’ Laravel Shared Data

coderello / Laravel Shared Data

Licence: mit
📦 An easy way to share the data from your backend to the JavaScript.

Laravel Shared Data

✨ Introduction

Laravel Shared Data provides an easy way to share the data from your backend to the JavaScript.

📖 Documentation

For installation instructions and usage details, please take a look at the official documentation.

🚀 Quick start

  • Install the package:

    composer require coderello/laravel-shared-data
    
  • Include the @shared directive into your blade layout before all scripts.

  • Share the data from within Laravel:

    share(['user' => $user, 'title' => $title]);
    
  • Access the data from the JavaScript directly:

    const user = window.sharedData.user;
    const title = window.sharedData.title;
    
  • Or using the built-it global helper:

    const user = shared('user');
    const title = shared('title');
    

📖 License

Laravel Shared Data is open-sourced software licensed under the MIT license.

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].