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:
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 localization Blade directive:
@lang
Hello there
@endlang
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.
You will see your pages and text in Paragraph.
To edit content in context, navigate to the Pages section and select the page you'd like to edit.
Contextual editor in Pages sections
The Content section will help you edit content across the entire website.
Content editor for entire website
This step should be automated with your favourite CI flow.
Pull updated content from Paragraph to your codebase where Laravel will pick up and present it to your users.
$ php artisan paragraph:download
A new or updated language file appear in your source control system. Commit it and deploy it to production.