Step 1 - Install

To integrate your Laravel application with Paragraph, first install our package using Composer:

$ composer require paragraph/laravel

Then, add the following two environment variables to your .env file:

Step 2 - Wrap texts (if not done yet)

If you are already using Laravel's helper functions and directives like trans(), __() and so on, you can skip this step. We will integrate with that automatically.

Otherwise, wrap any piece of text in your code in Laravel's special Blade directive:

   Hello there

Or use the function:

public function index() {
  // We are placing a message in the session - "All done"
  // It's now wrapped in Laravel localization function __()
  return redirect()->back()->with('message', __('All done!'));

Step 3 - Collect data

Now that Paragraph middleware is observing Blade rendering process behind the scenes, just send some test traffic any way you feel comfortable with – you could open a few pages on your local machine, you can run the test suite or or even push live and wait for real users to come.

Upload collected data (Blade renders) back to Paragraph to be able to edit your application pages in-place:

$ php artisan paragraph:submit-views

Of course, you could add this command to your cron file so that new pages get discovered and appear on Paragraph automatically.