A page folder corresponds to the folder.yaml files located within the page tree.

Get all page folders.

PageFolder::all(); // Returns \Illuminate\Support\Collection

A PageFolder will only exist when there is a folder.yaml. There isn’t a PageFolder for every folder.

Get a page folder by its handle (path).

A page folder’s handle is also it’s path, which would be something like pages/1.about/folder.yaml.

PageFolder::whereHandle($handle); // Returns PageFolder

Check if a page folder exists by its handle.

PageFolder::handleExists($handle); // Returns a boolean

Create a page folder

PageFolder::create($handle); // Returns a PageFolder

Import using:

use Statamic\API\PageFolder