🚨 WARNING 🚨 This repository its not maintained anymore, we don't recomend using anymore. |
---|
Headless WordPress Boilerplate to start a new project in WordPress in just 2 minutes, with MVC API generation like any other modern framework like Express, Flask or Slim PHP.
- Dockerfile for a working LAMP environment with PHP 7.2.19 and PHPMyAdmin.
- WordPress CLI (WP CLI).
- Support for
.env
file to easily publish into production with environment variables. - One commend install with
install.sh
bash script. - It comes with a WordPress Plugin ideal for using headless WordPress API working with typical MVC (Model View Controller) pattern.
- Composer integration to install plugins or PHP packages via package manager.
- Easy access to apache and PHP error log with commcommand: gp open /var/log/apache2/error.log
There are 3 ways of installing this:
- Use git to clone re repo
$ git clone [email protected]:4GeeksAcademy/wordpress-hello.git
- Just click here to use it with gitpod.
$ composer install
3) Create a .env file with your database and site information (on the workspace root) and run the run the installator
$ bash install.sh
Check your website, you are going to see a "Hello Rigoberto" message, you can login into the dashboard with your c9 username and the password you specified.
This boilerplate comes with a sample API andpoint already, all api enpoints can be added into the setup_api.php file like this:
// adding a GET /courses endpoint handled by the function getDraftCourses in the SampleController.php file
$api->get([ 'path' => '/courses', 'controller' => 'SampleController:getDraftCourses' ]);
Here is more info on how to create the API endpoints.
All the Post Types configuration is done in the setup_types.php file like this:
// adding Post Type "Course" handled by the file Course.php
$typeManager->newType(['type' => 'course', 'class' => 'Course'])->register();
Here is more info on how to create the post-types.