TwigFlow is a web application built with the Slim Framework and Twig templating engine. It fetches content from various CMS APIs (e.g., Payload CMS) and renders it using Twig templates. The application also includes a caching mechanism to reduce the number of API requests and improve performance.
- Fetches content from CMS APIs using slugs
- Renders content using Twig templates
- Caching mechanism to reduce API requests
- Supports multiple CMS services (e.g., Payload CMS, Sanity)
- Works on module-based logic with optional feature to process the module in PHP with additional info from CMSes (e.g., sending another request to fetch featured news in the news module) supporting async requests
- PHP 8.2 or higher
- Composer
- MAMP (or any other local development environment)
-
Clone the TwigFlow boilerplate repository:
git clone https://github.com/antymoro/twigflow-boilerplate.git cd twigflow-boilerplate -
Install the TwigFlow package via Composer:
composer require antymoro/twigflow:dev-main --prefer-stable
-
Set up environment variables:
Create a
.envfile in the root directory and add the necessary environment variables:API_URL=https://id.api.sanity.io/v2022-03-07 CMS_CLIENT=sanity APP_ENV=development CACHE_EXPIRE_TIME=0 TWIG_CACHE=false HOMEPAGE_SLUG=homepage
-
Set up the web server:
If you are using MAMP, set the document root to the root folder of the project.
If you are using MAMP, start the Apache and MySQL servers.
Open your web browser and navigate to:
http://localhost:[port]
Replace [port] with the port number configured in MAMP.
To clear the cache, send a POST request to:
http://localhost:[port]/clear-cache
```# huncwot-payload