-
Lifecycle of a Backend Request
This document outlines the lifecycle of a backend a request on the Vanilla platform, from CDN to web server, to response. CDN / Cloudflare On Vanilla Cloud every requests request starts in Cloudflare. Here one of a few things may happen: Request may be blocked by rate-limiting rules. A cached response may be found and…
-
APIv2 for Developers
The Vanilla APIv2 Vanilla’s APIv2 offers a powerful, yet simple way of creating RESTful API endpoints in your application. With version 2 of the API we consider Vanilla to be an “API first” framework where you write your API first and then think about the resulting HTML. This offers several benefits: An API is easier to…
-
Running PHP Tests
Vanilla uses PHPUnit for testing it's backend code. Tests are written in PHP and can be easily run the from command line, or more commonly using PHPStorm. Required Test Setup The easiest way to get the full test harness setup is to use vanilla-docker. After setting up vanilla docker, you will need to ensure you have a…
-
Dispatching & URLs
Overview Vanilla has 3 primary ways of dispatching URLs and they are tried in the following order. Routes registered with Garden\Web\Dispatcher. Pages using Gdn_Dispatcher. Redirects from Gdn_Router. Garden\Web\Dispatcher Routes There are primarily 2 types of routes dispatched from Garden\Web\Dispatcher.…
-
What is Dependency Injection
Overview Dependency injection is a programming technique that makes a class independent of its dependencies. It achieves that by decoupling the usage of an object from its creation. Imagine you have class Page which requires Request and Permissions in order to function. In the most naive implementation you might see…
-
Database Layer
Vanilla only supports MySQL. It has a generic SQL driver implementation built on top of PDO to potentially allow for other databases (which you can see in /library/databases). However, at this time, the Vanilla team has no plans to support additional databases. The best way to access the database is via existing models.…
-
CRON (aka time-based job scheduler)
What is a cron job? A cron job is just a plain old job that will run at specific intervals of time based on a cron expression. How and where to schedule a cron job? Cron jobs need to be scheduled on the bootstrap process and the Scheduler will trigger those when the POST /api/v2/scheduler/cron endpoint is hit. What will…
-
Sending Emails
The Garden framework includes an Email object for sending and configuring emails. The formatting of Vanilla Emails is handled by the EmailTemplate property of the Email object. EmailTemplate The EmailTemplate object helps to organize the components of an email and prepare them for output. These components are: Title: A…
-
Importing to Vanilla
Already have a community on another platform? Great! We have a tool called Vanilla Porter that can help you migrate from many other popular platforms. Overview Download Vanilla Porter Vanilla Porter is a tool that you can upload to your current web server to run in your web browser. It exports any platform to a generic…
-
Controller Assets
Assets organize content in a document. Assets are called by the main template (e.g. default.master.tpl) which renders the content currently stored in them. Assets are managed with code via plugins or the theme hooks file. Default assets Vanilla uses these assets by default: Head, Content, Panel, and Foot. You cannot rely…