This app uses Blade templates but ButterCMS works with any templating engine like Smarty, Twig, or raw PHP.
This project was created as an example use case of ButterCMS in conjunction with laravel, and will not be actively maintained.
If you’re interested in exploring the best, most up-to-date way to integrate Butter into php frameworks like laravel, you can check out the following resources:
The following turn-key starters are fully integrated with dynamic sample content from your ButterCMS account, including main menu, pages, blog posts, categories, and tags, all with a beautiful, custom theme with already-implemented search functionality. All of the included sample content is automatically created in your account dashboard when you sign up for a free trial of ButterCMS.
- Laravel Starter
- Angular Starter
- React Starter
- Vue.js Starter
- Or see a list of all our currently-maintained starters. (Over a dozen and counting!)
- Check out the official ButterCMS Docs
- Check out the official ButterCMS API docs
Install dependencies:
$ composer install
Start the app:
$ php artisan serve
This example application demonstrates three major features of the ButterCMS API — blogging, dynamic content, and dynamic pages. All of the features are implemented in the following files:
app/Http/Controllers/BlogController.php
: The application controller.routes/web.php
: The routes for the controller methods.resources/*.blade.php
: The Laravel/Blade templates used for rendering the content.
The blogging features are split into four main areas withing the app — posts, categories, tags, and authors. Each area has a main page and a detail page.
-
Blog posts are loaded in the
listAllPosts()
andshowPost()
methods of theBlogController
and rendered to theposts.blade.php
andpost.blade.php
templates. -
Post categories are loaded in the
listAllCategories()
andshowCategory()
methods and rendered to thecategories.blade.php
andcategory.blade.php
templates. -
Post tags are loaded in the
listAllTags()
andshowTag()
methods and rendered to thetags.blade.php
andtag.blade.php
templates. -
Post authors are loaded in the
listAllAuthors()
andshowAuthor()
methodsd and rendered to theauthors.blade.php
andauthor.blade.php
templates.
Dynamic content is demonstrated with a Frequenly Asked Question page. FAQ questions and answers, as well as the page headline, are loaded in the showFaq()
method of the BlogController
and rendered to the faq.blade.php
template.
Dynamic pages are demonstrated with mock store location pages. Location page data is loaded by the listAllLocations()
and showLocation()
method of the BlogController
and rendered to the locations.blade.php
and location.blade.php
templates.
For a comprehensive list of examples and API docs, check out our documentation.
View Laravel Full CMS for other examples of using ButterCMS with Laravel.