### Install a First-Party Addon Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/overview.4.md Some first-party addons have dedicated installation commands. This example shows how to install the Static Site Generator addon. ```shell php please install:ssg ``` -------------------------------- ### Install Dependencies and Start Vite Dev Server Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/vite-tooling.md Run these commands in your addon's directory to install npm packages and start the Vite development server. This is necessary to avoid 'Vite manifest not found' errors in the Statamic CP. ```bash cd addons/your/addon npm install npm run dev ``` -------------------------------- ### Setup Vite for Control Panel Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/css-javascript.md Run this command to install Vite dependencies and create configuration files for the Control Panel. ```bash php please setup-cp-vite ``` -------------------------------- ### Install Starter Kit with Site Clear Option Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/installing-a-starter-kit.md Force the installer to clear your site's content before installing the starter kit by using the `--clear-site` option. ```shell php please starter-kit:install vendor-name/starter-kit-name --clear-site ``` -------------------------------- ### Full Site Configuration Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/multi-site.md A complete example of a site configuration including custom attributes. ```yaml # resources/sites.yaml en: name: English url: / locale: en_US lang: en attributes: theme: standard ``` -------------------------------- ### Get an Entry by Slug and Site Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/entry-repository.md Retrieve an entry by its slug and site in a multi-site installation. This ensures you get the correct entry for a specific site. ```php Entry::query() ->where('collection', 'team') ->where('slug', 'director') ->where('site', 'albuquerque') ->get(); ``` -------------------------------- ### Install Starter Kit into New Site Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/installing-a-starter-kit.md Use this command to create a new Statamic site and install a starter kit simultaneously. ```shell statamic new my-site vendor/starter-kit ``` -------------------------------- ### Install Starter Kit with Configuration Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Use this command to install a starter kit into a new Statamic project while preserving the starter-kit.yaml configuration file. ```shell statamic new kung-fury-dev the-hoff/kung-fury-theme --with-config ``` -------------------------------- ### Install Starter Kit locally Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Use the --local flag with the Statamic CLI to install a Starter Kit from a configured local repository. ```bash statamic new kung-fury-dev the-hoff/kung-fury-theme --local ``` -------------------------------- ### Example File Path Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/path.md This is an example of a file path relative to an asset container. ```html img/black-bear-cubs.jpg ``` -------------------------------- ### Install Starter Kit Without Dependencies Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/installing-a-starter-kit.md Install a starter kit while excluding any bundled dependencies using the `--without-dependencies` option. ```shell php please starter-kit:install vendor-name/starter-kit-name --without-dependencies ``` -------------------------------- ### Install Starter Kit into Existing Site Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/installing-a-starter-kit.md Run this command within an existing Statamic site's root directory to install a starter kit. ```shell php please starter-kit:install vendor-name/starter-kit-name ``` -------------------------------- ### Example Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/current_url.md This is an example of what the `current_url` variable might output. ```html https://statamic.dev/variables/current_url ``` -------------------------------- ### Example Rendered Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/taxonomies.md This is an example of how the taxonomy terms might be rendered on the frontend. ```html ``` -------------------------------- ### Install Dependencies and Configure Environment Source: https://github.com/statamic/docs/blob/6.x/README.md Install project dependencies using Composer and npm, then copy the environment file and generate the application key. ```bash composer install npm install npm run dev cp .env.example .env php artisan key:generate ``` -------------------------------- ### Example Site Handles Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/sites.md Illustrates how site handles might be configured. ```yaml sites: - english - french - german ``` -------------------------------- ### Download and Install Composer Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Installs Composer, a dependency manager for PHP, by downloading the installer script and moving it to a global bin directory. ```shell curl -sS https://getcomposer.org/installer | php ``` ```shell sudo mv composer.phar /usr/local/bin/composer sudo chmod +x /usr/local/bin/composer ``` -------------------------------- ### Install Eloquent Driver Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/storing-content-in-a-database.md Install the Eloquent Driver addon to enable database storage for Statamic content. ```bash php please install:eloquent-driver ``` -------------------------------- ### Install package from source Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/using-composer-patches.md Force a package to install from source to include test files for patching. ```json { "config": { "preferred-install": { "statamic/cms": "source" } } } ``` -------------------------------- ### Example Homepage URL Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/homepage.md This is an example of what the homepage URL might look like when rendered. ```html https://docs.statamic.com/ ``` -------------------------------- ### Install Nginx Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Installs the Nginx web server on Ubuntu. The `-y` flag automatically confirms any prompts during installation. ```shell sudo apt install nginx -y ``` -------------------------------- ### Install Composer Dependencies Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/digitalocean.md Change into the cloned Statamic directory and install its Composer dependencies. ```bash cd demo composer install ``` -------------------------------- ### Basic GraphQL Query Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/graphql.md An example of a GraphQL query to fetch products, including their name and price. ```graphql { products { name price } } ``` -------------------------------- ### Example Rendered Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/collections.md This is an example of how the collection data might be rendered in HTML. ```html ``` -------------------------------- ### Rendered HTML Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/sites.md Example of the HTML output after fetching content from selected sites. ```html ``` -------------------------------- ### Publish Assets Command Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-an-addon.md Shows the Artisan command executed to publish your addon's assets, tagged with your addon's slug. This command is typically run automatically after installation. ```shell php artisan vendor:publish --tag=your-addon-slug --force ``` -------------------------------- ### Install Algolia PHP Client Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/search.md Install the required Algolia search client via Composer. ```shell composer require algolia/algoliasearch-client-php:^3.4 ``` -------------------------------- ### Map GET Request to Controller Method Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/controllers.md Defines a GET route for '/example' that will be handled by the 'index' method of the ExampleController. ```php use App\Http\Controllers\ExampleController; Route::get('example', [ExampleController::class, 'index']); ``` -------------------------------- ### Install Statamic Importer Addon Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/importing-content.md Install the Importer addon using Composer. This is the recommended method for importing content. ```bash composer require statamic/importer ``` -------------------------------- ### Example Layout Name Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/current_layout.md This is an example of the output you might expect when accessing the current layout variable. ```html layouts.blog ``` -------------------------------- ### Example Width Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/width.md This is an example of the numerical output for the width variable. ```html 900 ``` -------------------------------- ### Example Input Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/rawurlencode.md This is the input string that will be URL-encoded. ```yaml example: please and thank you/Mommy ``` -------------------------------- ### Get Users API Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when retrieving a list of users via the API. ```json { "data": [ { "id": "1", "email": "john@smith.com", "api_url": "http://example.com/api/users/1" } ], "links": {...}, "meta": {...} } ``` -------------------------------- ### Implement a post-install hook Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Create a StarterKitPostInstall.php file in the root of your Starter Kit to execute custom logic after installation. ```php line('Thanks for installing!'); } } ``` -------------------------------- ### Example Output of Entries Count Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/entries_count.md This is an example of how the 'entries_count' variable might be rendered in HTML. ```html There are 85 'news' entries. ``` -------------------------------- ### Addon Directory Structure Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-an-addon.md An example of the typical file and directory layout for a Statamic addon, including source files and configuration. ```files addons/ acme/ example/ src/ ServiceProvider.php composer.json app/ content/ config/ public/ index.php resources composer.json ``` -------------------------------- ### Get Form API Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when retrieving a single form via the API. ```json { "data": { "handle": "contact", "title": "Contact", "fields": { "name": {...}, "email": {...}, "inquiry": {...} }, "api_url": "http://example.com/api/forms/contact" } } ``` -------------------------------- ### Get Single User API Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when retrieving a single user via the API. ```json { "data": { "id": "1", "email": "john@smith.com", "api_url": "http://example.com/api/users/1" } } ``` -------------------------------- ### Example JSON Translation File Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/trans.md An example of a JSON language file for translations. ```json { "Hello": "Bonjour" } ``` -------------------------------- ### Get Collection Tree JSON Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response for a structured collection's entry tree. ```json { "data": [ { "page": { "title": "About", "url": "/about" }, "depth": 1, "children": [ { "page": { "title": "Articles", "url": "/about/articles" }, "depth": 2, "children": [] } ] } ] } ``` -------------------------------- ### Static HTML Image Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/assets.md An example of how image tags might be rendered statically. ```html Will Smith as the Fresh Prince Jeffrey Allen Townes as DJ Jazzy Jeff James Avery as Uncle Phil 3 colorful surf boards ``` -------------------------------- ### Get Single Entry JSON Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when fetching a single entry using the API. ```json { "data": { "title": "My First Day" } } ``` -------------------------------- ### Example Translation File Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/trans.md This is an example of a PHP language file used for translations. ```php 'Bar!', 'welcome' => 'Welcome, :name!', 'apples' => 'There is one apple|There are :count apples', ]; ``` -------------------------------- ### Get Taxonomy Terms Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Retrieves a list of terms within a specified taxonomy. Supports filtering by site for multi-site setups. ```APIDOC ## GET /api/taxonomies/{taxonomy}/terms ### Description Gets terms in a taxonomy. ### Endpoint `/api/taxonomies/{taxonomy}/terms` ### Query Parameters - **site** (string) - Optional - Used with Multi-Site to select a specific site (e.g., `&filter[site]=fr`). ### Response Example ```json { "data": [ { "title": "Music" } ], "links": {...}, "meta": {...} } ``` ``` -------------------------------- ### Formatted Date Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/date.md This shows an example of how the date might be rendered in a template, formatted according to system settings. ```html February 16, 2016 ``` -------------------------------- ### Example Create Site API Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/sites-api.md This is an example of the JSON response when successfully creating a new Statamic site using the Create Site endpoint. ```json { "data": { "name": "Jurassic World", "key": "pwkknrxl6y7z1n9v", "domains": [ "jurassicworld.ca", "staging.jurassicworld.ca" ], "created_at": "2021-11-18 19:45:41" } } ``` -------------------------------- ### YAML Front Matter Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/read_time.md Example of front matter for a post, including a title and content. ```yaml --- title: A long post --- Pretend there are lots of words here... ``` -------------------------------- ### Slugify Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/slugify.md The expected output after applying the slugify modifier to the example string. ```html please-have-some-lemonade ``` -------------------------------- ### Exporting a Starter Kit Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Run this command to copy and arrange files into a distributable directory. ```shell php please starter-kit:export {export_repo_path} ``` -------------------------------- ### Initialize a Starter Kit Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Run this command in a new Statamic project to prepare it for Starter Kit development. ```shell php please starter-kit:init ``` -------------------------------- ### Default Preferences Storage Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/preferences.md Default preferences are stored in a YAML file. This example shows the structure for locale and start page settings. ```yaml locale: en start_page: collections/articles ``` -------------------------------- ### Install spatie/fork for Fork Concurrency Driver Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/stache.md Install the `spatie/fork` package using Composer if you intend to use the `fork` concurrency driver for parallel warming. This driver is faster but CLI-only and requires the `pcntl` extension. ```shell composer require spatie/fork ``` -------------------------------- ### Install PHP and Required Modules on Ubuntu Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Installs PHP along with common modules and extensions necessary for web applications. ```shell sudo apt install php-common php-fpm php-json php-mbstring zip unzip php-zip php-cli php-xml php-tokenizer php-curl php-gd -y ``` -------------------------------- ### Example Output of Size Bytes Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/size_bytes.md This is an example of the raw output for the `size_bytes` variable, representing the file size in bytes. ```html 130754 ``` -------------------------------- ### Get Asset Container API Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when retrieving a container's asset data via the API. ```json { "data": [ { "id": "main::foo.jpg", "url": "/assets/foo.jpg", "api_url": "http://example.com/api/assets/main/foo.jpg", "alt": "A picture of nothing." } ], "links": {...}, "meta": {...} } ``` -------------------------------- ### File Dictionary Data Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/dictionary.md Example structure for data within a file dictionary, including custom 'id' and 'name' keys. ```json [ {"name": "Apple", "id": "apple", "emoji": "🍎"}, {"name": "Banana", "id": "banana", "emoji": "🍌"}, {"name": "Cherry", "id": "cherry", "emoji": "🍒"}, ... ] ``` -------------------------------- ### Get Last URL Segment in Blade Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/last_segment.md Use this Blade directive to output the last segment of the current URL. No setup is required. ```blade {{ $last_segment }} ``` -------------------------------- ### Create a sandbox project Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/contribution-guide.md Install a Statamic starter kit into a new directory to serve as a sandbox for testing changes. ```shell cd sites # [tl! **] statamic new sandbox # [tl! **] Creating a statamic/statamic project at ./sandbox [✔] Statamic has been successfully installed into the sandbox directory. Build something rad! ``` -------------------------------- ### Basic Antlers View Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/views.md A simple example of an Antlers view file, demonstrating basic HTML structure. ```html

The invention of the shovel was ground breaking.

``` -------------------------------- ### Start Sail Containers Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/docker.md Start all Docker containers defined in your compose.yaml file to run your application. ```shell ./vendor/bin/sail up ``` -------------------------------- ### Get Last URL Segment in Antlers Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/last_segment.md Use this Antlers tag to output the last segment of the current URL. No setup is required. ```antlers {{ last_segment }} ``` -------------------------------- ### Example Rendered Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/range.md An example of how the range field's value might be rendered in HTML. ```html

My favorite number is 42.

``` -------------------------------- ### Verify Statamic CLI installation Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/local.md Run the list command to confirm the CLI is correctly installed and accessible. ```shell statamic list ``` -------------------------------- ### Export a Starter Kit Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Export the relevant files and directories to a separate repository for redistribution. ```shell php please starter-kit:export ../kung-fury-theme ``` -------------------------------- ### Get URL Segment with Blade Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/segment_x.md Use `segment_x` in Blade to access a specific URL segment. For example, `$segment_3` returns the third segment. ```blade {{ $segment_3 }} ``` -------------------------------- ### Get URL Segment with Antlers Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/segment_x.md Use `segment_x` in Antlers to access a specific URL segment. For example, `segment_3` returns the third segment. ```antlers {{ segment_3 }} ``` -------------------------------- ### Start the local development server Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/local.md Launch the built-in PHP development server to access your site locally. ```cli $ php artisan serve Starting Laravel development server: http://127.0.0.1:8000 ``` -------------------------------- ### Get Entries by Date Range Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/entry-repository.md Query entries based on their date field. Examples include fetching entries before a specific year or within the last year. ```php Entry::query() ->where('collection', 'news') ->where('date', '<', '2000') // [tl! ~~] ->get(); ``` ```php use Illuminate\support\Carbon; Entry::query() ->where('collection', 'news') ->where('date', Carbon::parse('today')) ->get(); ``` ```php use Illuminate\support\Carbon; Entry::query() ->where('collection', 'news') ->where('date', '>=', Carbon::parse('now')->subYears(1)) ->get(); ``` -------------------------------- ### Configuring Export Paths Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Define the files and directories to include in the Starter Kit within the starter-kit.yaml file. ```yaml export_paths: - content - config/filesystems.php - config/statamic/assets.php - resources/blueprints - resources/css/site.css - resources/views - public/assets - public/css - package.json - vite.config.js ``` -------------------------------- ### Resolve Full Array Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/resolve.md Omit the key when using the Resolve modifier to get the entire array of items. This is useful for passing the resolved data to other modifiers, such as 'count' in this example. ```antlers {{ gallery | resolve | count }} ``` ```blade {{ Statamic::modify($gallery)->resolve()->count() }} ``` -------------------------------- ### Example Augmented User Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/users.md This is an example of what the augmented user data might look like in HTML. ```html
Avatar of David Hasselhoff

David Hasselhoff

thehoff@statamic.com

``` -------------------------------- ### Example Input String Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/trim.md This is the input string with leading and trailing whitespace that will be trimmed. ```yaml string: " This is so sloppy " ``` -------------------------------- ### Resolve Specific Item by Index Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/resolve.md Use the Resolve modifier with an index to get a specific item from an array or collection. This example retrieves the URL of the first item in the 'gallery'. ```antlers ``` ```blade ``` -------------------------------- ### Starter Kit Directory Structure Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md The package directory must contain at least a composer.json and starter-kit.yaml file. ```files app/ content/ config/ package/ #[tl! ++] composer.json #[tl! ++] starter-kit.yaml #[tl! ++] public/ resources/ composer.json ``` ```files package/ composer.json starter-kit.yaml README.md #[tl! ++] ``` -------------------------------- ### Get Entries Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Retrieves entries within a specified collection. Supports sorting, field selection, and pagination. Can serve entries from all sites in a multi-site setup or be filtered by site. ```APIDOC ## Entries `GET` `/api/collections/{collection}/entries` Gets entries within a collection. ``` json { "data": [ { "title": "My First Day" } ], "links": {...}, "meta": {...} } ``` :::tip If you are using [Multi-Site](/multi-site), the entries endpoint will serve from all sites at once. If needed, you can limit the fetched data to a specific site with a `site` [filter](#filtering) (ie. `&filter[site]=fr`). ::: ``` -------------------------------- ### Enable Updatable Starter Kit Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Add this configuration to your starter-kit.yaml file to keep the kit as a Composer dependency after installation. ```yaml updatable: true #[tl! ++] export_paths: ... ``` -------------------------------- ### Install Alpine Precognition adapter Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/forms.md Install the required npm package to enable Precognition support in Alpine.js. ```shell npm install laravel-precognition-alpine ``` -------------------------------- ### Custom Cache Driver Implementation Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example implementation of a custom cache driver extending `Statamic\API\AbstractCacher`. It shows the required methods for `get`, `put`, and `handleInvalidationEvent`, and how to access custom configuration. ```php use Statamic\API\AbstractCacher; class CustomCacher extends AbstractCacher { public function get(Request $request) { // } public function put(Request $request, JsonResponse $response) { // } public function handleInvalidationEvent(Event $event) { // } } ``` -------------------------------- ### Timezones Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/dictionary.md Sample output for timezone names and offsets. ```text America/New_York -04:00 Australia/Sydney +10:00 ``` -------------------------------- ### Copy Environment File Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/digitalocean.md Copy the example environment file to create the actual environment file for your application. ```bash cp .env.example .env ``` -------------------------------- ### Currencies Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/dictionary.md Shows the formatted output for currency information. ```text US Dollar, USD, $, 2 Hungarian Forint, HUF, Ft, 0 ``` -------------------------------- ### Enable 2FA Form (Antlers) Source: https://github.com/statamic/docs/blob/6.x/content/collections/tags/user-two_factor_enable_form.md Renders the form for enabling two-factor authentication. Includes error handling and a submit button. Use when a user needs to start the 2FA setup process. ```antlers {{ user:two_factor_enable_form redirect="/account/2fa/setup" }} {{ if errors }}
{{ errors }} {{ value }}
{{ /errors }}
{{ /if }}

Click below to start setting up two-factor authentication. You'll be taken to a page where you can scan a QR code with your authenticator app.

{{ /user:two_factor_enable_form }} ``` -------------------------------- ### Example User Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/current_user.md This HTML demonstrates how user data might be displayed, showing a username and email address. ```html Example User user@example.com ``` -------------------------------- ### Initialize and Deploy Code with Git Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/fortrabbit.md Steps to initialize a Git repository, add the fortrabbit remote, commit changes, and perform the initial push to your fortrabbit deployment server. ```shell # 1. Initialize Git git init # 2. Add your Apps Git remote to your local repo git remote add fortrabbit {{appname}}@deploy.{{region}}.frbit.com:{{appname}}.git # 4. Add changes to Git git add -A # 5. Commit changes git commit -m 'My first commit' # 6. Initial push and upstream git push -u fortrabbit main # From there on only git push ``` -------------------------------- ### Get Single Asset API Response Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example JSON response when retrieving a single asset's data via the API. The path in the URL should be the relative path from the container's root. ```json { "data": { "id": "main::foo.jpg", "url": "/assets/foo.jpg", "api_url": "http://example.com/api/assets/main/foo.jpg", "alt": "A picture of nothing." } } ``` -------------------------------- ### Example XML Header Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/xml_header.md This is the resulting XML header tag that will be outputted. ```html ``` -------------------------------- ### Example Output of Basename Variable Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/basename.md This example shows the typical output when using the basename variable, which is the complete filename of an asset including its extension. ```html black-bear-cubs.jpg ``` -------------------------------- ### Create a new Statamic project Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/local.md Initialize a new Statamic site using the CLI wizard. ```shell statamic new project_name ``` -------------------------------- ### Enable 2FA Form (Blade) Source: https://github.com/statamic/docs/blob/6.x/content/collections/tags/user-two_factor_enable_form.md Renders the form for enabling two-factor authentication using Blade syntax. Includes error handling and a submit button. Use when a user needs to start the 2FA setup process. ```blade @if ($errors)
@foreach ($errors as $error) {{ $error }}
@endforeach
@endif

Click below to start setting up two-factor authentication. You'll be taken to a page where you can scan a QR code with your authenticator app.

``` -------------------------------- ### Install Laravel Sail Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/docker.md Install Laravel Sail into a new Laravel application. Use '--with=none' if you don't need additional services like MySQL initially. ```shell composer require laravel/sail --dev php artisan sail:install --with=none ``` -------------------------------- ### Filter by Multiple String Absences using Not Like Operator Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/content-queries.md Use the 'not like' operator with an array of patterns to exclude records matching any of the specified patterns. This example finds users whose names do not start with 'Dr.' and do not end with 'MD' or 'M.D.'. ```php User::query() ->where('name', 'not like', ['Dr.%', '%MD', '%M.D.']) ->get(); ``` -------------------------------- ### Example Folder Structure for Zero Downtime Deployments Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/zero-downtime-deployments.md Illustrates a typical directory structure used by zero-downtime deployment services, highlighting shared files and symlinked releases. ```text .env storage current -> symlinked to latest release releases 20220215112950 .env -> symlinked to top level shared .env storage -> symlinked to top level shared storage app routes etc 20220322153109 20230323180225 20220322153109 ``` -------------------------------- ### Example Output String Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/trim.md This is the resulting string after the trim modifier has been applied. ```html This is so sloppy ``` -------------------------------- ### Install FFmpeg for Video Thumbnails Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/assets.md Video thumbnail generation requires FFmpeg. Install it using your system's package manager. ```shell # macOS (Homebrew) brew install ffmpeg # Ubuntu/Debian sudo apt install ffmpeg ``` -------------------------------- ### Install Eloquent Driver for Assets Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/optimizing-assets.md Use this command to switch asset indexing from flat-file to a database driver. ```shell php please install:eloquent-driver ``` -------------------------------- ### Camelize Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/camelize.md Demonstrates the expected output after applying the camelize transformation to a string. ```html makeEverythingBetter ``` -------------------------------- ### Blade Tag Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-a-tag.md An equivalent custom tag example using Blade syntax, mirroring the parameter types shown in the Antlers example. ```blade ``` -------------------------------- ### Example Output of Now Variable Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/now.md This shows the typical output format when the `now` variable is used on its own. ```html December 30th 2015 ``` -------------------------------- ### Run Custom Commands After Installation Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-an-addon.md Execute custom Artisan commands or other logic after your addon has been installed. This is useful for setting up initial configurations or publishing assets. ```php public function bootAddon() { Statamic::afterInstalled(function ($command) { $command->call('some:command'); }); } ``` -------------------------------- ### Private Addon Installation Configuration Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-an-addon.md Configure composer.json to install a private addon using a path repository, specifying the package and its local path. ```json { ... "require": { ..., "acme/example": "*" }, ... "repositories": [ { "type": "path", "url": "addons/example" } ] } ``` -------------------------------- ### Example Order Key Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/order.md This demonstrates a typical output for the 'order' variable, which is often a numerical value. ```html 1 ``` -------------------------------- ### Timezones Data Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/dictionary.md Example data structure for timezones. ```yaml timezones: - America/New_York - Australia/Sydney ``` -------------------------------- ### Convert existing content to multi-site Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/multi-site.md Run this command to automatically convert an existing single-site installation into a multi-site friendly structure. ```shell php please multisite ``` -------------------------------- ### Configure an optional module Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Define an optional module under the modules key in starter-kit.yaml to present an installation choice to the user. ```yaml modules: seo: dependencies: - statamic/seo-pro ``` -------------------------------- ### Example Content ID Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/id.md This is an example of a typical content ID format. ```html 0020c540-d4cd-11e5-a837-0800200c9a66 ``` -------------------------------- ### Tag Pair with Installed Tag Source: https://github.com/statamic/docs/blob/6.x/content/collections/tags/installed.md Use the installed tag as a pair to output content only if the specified Composer package is installed. If the package is not found, nothing within the tag pair will be rendered. ```antlers {{ installed:statamic/seo-pro }} {{ seo_pro:meta }} {{ /installed:statamic/seo-pro }} ``` ```blade ``` -------------------------------- ### OrderBy configuration and usage Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/antlers.md Examples of sorting data using variables and literal strings. ```yaml dir: 'asc' shouldSortAscending: false ``` ```antlers {{ people orderby (age 'desc', last_name 'asc', first_name 'asc') }} {{ places orderby (state $dir, city $dir, zip_code $dir) }} {{ things = {collection:hats} merge {collection:books} orderby (rating $shouldSortAscending) }} ``` -------------------------------- ### Action with Download Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/actions.md Implement the `download` method to return a file path or a download response, triggering a file download for the user. ```php public function download($items, $values) { return storage_path('some/file.pdf'); } ``` -------------------------------- ### Configure module export paths Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Modules support the same configuration options as the top-level starter-kit.yaml, such as export_paths. ```yaml modules: seo: export_paths: - resources/css/seo.css dependencies: - statamic/seo-pro ``` -------------------------------- ### Publish Starter Kit Assets Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/updating-a-starter-kit.md After updating, you may need to re-publish the starter kit's assets. Consult the starter kit's documentation for the correct tag. ```shell php artisan vendor:publish --tag=starter-kit-name ``` -------------------------------- ### Full Example: Artists Dictionary using MusicBrainz API Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/dictionaries.md A complete example of a custom dictionary class that fetches artist data from the MusicBrainz API. It utilizes caching for performance and provides options for searching artists. ```php json(); return collect($response['artists'])->mapWithKeys(function ($artist) { $label = $artist['name']; if ($disambiguation = $artist['disambiguation'] ?? null) { $label .= ' ('.$disambiguation.')'; } return [$artist['id'] => $label]; })->all(); } public function get(string $key): ?Item { return Cache::rememberForever('artist-'.$key, function () use ($key) { $response = Http::get('https://musicbrainz.org/ws/2/artist/'.$key.'?fmt=json')->json(); return new Item($key, $response['name'], [ 'name' => $response['name'], 'disambiguation' => $response['disambiguation'] ?? null, 'type' => $response['type'], 'country' => $response['country'], ]); }); } } ``` -------------------------------- ### Example SVG Icon Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/icon.md This is an example of an SVG icon that the fieldtype might return. ```html ``` -------------------------------- ### Configure Path Repository Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Add the package directory as a path repository in your composer.json to make the Starter Kit updatable. ```json { "name": "statamic/statamic", "require": [ "the-hoff/kung-fury-theme": "dev-master" // [tl! ++] ], "repositories": [ // [tl! ++:start] { "type": "path", "url": "package" } ] // [tl! ++:end] } ``` -------------------------------- ### Create New Statamic Application Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Creates a new Statamic application named 'example.com'. This command may require updating your system's PATH if the `statamic` command is not found. ```shell statamic new example.com ``` -------------------------------- ### Data Structure Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/fieldtypes/width.md The selected width is stored as a simple integer in the data file. ```yaml image_width: 50 ``` -------------------------------- ### Invalid Variable Name Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/antlers.md Shows an example of an invalid variable name that should be avoided. ```antlers {{ this_iS-RiDicuL-ou5_ }} ``` -------------------------------- ### Enable Nginx Site and Reload Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Creates a symbolic link to enable the new Nginx site configuration and then reloads Nginx to apply the changes. ```shell sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/ sudo systemctl reload nginx ``` -------------------------------- ### Create New Entry Instance Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/data.md Use the `make` method on the Entry facade to create a new instance. You can then chain methods to set properties before saving. ```php use Statamic\Facades\Entry; $entry = Entry::make() ->published(true) ->data(['title' => 'About us', 'subtitle' => 'We are awesome']) ->etc(); // and so on... $entry->save(); ``` -------------------------------- ### Define site and search index configuration Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/search.md Example configuration for site definitions and the default search index settings. ```yaml # resources/sites.yaml en: url: / fr: url: /fr/ de: url: /de/ ``` ```php // config/statamic/search.php 'indexes' => [ 'default' => [ 'driver' => 'local', 'searchables' => 'content', ] ] ``` -------------------------------- ### Example Favicon Meta Tag Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/favicon.md This is an example of the HTML output generated by the Favicon modifier. ```html ``` -------------------------------- ### Re-compile Assets Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/updating-a-starter-kit.md If the starter kit includes CSS or JavaScript, you may need to re-compile these assets after an update. ```shell npm run dev ``` -------------------------------- ### Create New Form Instance Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/form-repository.md Start the process of creating a new form by making an instance and setting its handle. ```php $form = Form::make()->handle('feedback'); ``` -------------------------------- ### Verify Composer Installation Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Checks if Composer has been installed correctly and is accessible in the system's PATH. ```shell composer ``` -------------------------------- ### Update Ubuntu Packages Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/ubuntu.md Ensure your package lists and installed packages are up to date before proceeding with installations. ```shell sudo apt-get update sudo apt-get upgrade ``` -------------------------------- ### Create a New User Group Instance Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/user-group-repository.md Initialize a new user group instance using the `make` method, optionally passing the handle. ```php $group = UserGroup::make('admin'); ``` -------------------------------- ### Create and Save Asset Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/asset-repository.md Demonstrates creating a new asset instance, setting its container and path, adding data, and saving it. ```APIDOC ## Creating and Saving an Asset ### Description Start by making an instance of an asset with the `make` method. You need at least a path and the container before you can save an asset. ### Code Example ```php $asset = Asset::make()->container('assets')->path('images/hat.jpg'); // Or, if you have an asset container instance: // $asset = $container->makeAsset('images/hat.jpg'); $asset->data(['foo' => 'bar']); $asset->save(); // true or false ``` ### Note Saving an asset instance will only store the metadata. You must manually place the asset file or use the `upload` method. ``` -------------------------------- ### Start Sail Containers in Detached Mode Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/docker.md Start Docker containers in the background for continuous operation. ```shell ./vendor/bin/sail up -d ``` -------------------------------- ### Initialize and configure remote repository Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/git-automation.md Commands to manually set up a Git remote and track a branch on a server. ```shell git init git remote add origin git@github.com:your/remote-repository.git git fetch git branch --track master origin/master git reset HEAD ``` -------------------------------- ### Install Statamic CLI globally Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/local.md Use Composer to install the Statamic CLI tool globally on your system. ```shell composer global require statamic/cli ``` -------------------------------- ### Install Public Addon via Composer Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/building-an-addon.md Install a publicly available addon from Packagist by requiring it with composer. ```shell composer require vendor/package ``` -------------------------------- ### Create Entry Instance with Entry Facade Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/data.md Utilize the Entry facade to create new entry instances. This facade proxies calls to the `EntryRepository` contract, which can be configured to use different storage implementations like Stache or a database. ```php Statamic\Facades\Entry::make(); // This calls the `make` method on an instance of `Statamic\Contracts\Entries\EntryRepository` // By default it's `Statamic\Stache\Repositories\EntryRepository`, but could change. ``` -------------------------------- ### Create and Configure a New Collection Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/collection-repository.md Instantiate a new collection with a handle and chain methods to configure its properties like title, routes, site assignments, and more. ```php $collection = Collection::make('assets'); $collection ->title('Blog') ->routes('/blog/{slug}') // a string, or array of strings per site ->mount('blog-page') // id of an entry ->dated(true) ->ampable(false) ->sites(['one', 'two']) // array of handles ->template('template') ->layout('layout') ->cascade($data) // an array ->searchIndex('blog') // index name ->revisionsEnabled(false) ->defaultPublishState('published') // or 'draft' ->structureContents($structure) // an array ->sortField('field') // the field to sort by default ->sortDirection('asc') // or 'desc' ->taxonomies(['tags']) // array of handles ->propagate(true); ``` -------------------------------- ### Equivalent Commands Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/cli.md Demonstrates that `php please` is an alias for `php artisan statamic:`. ```shell # These are equivalent php please make:user php artisan statamic:make:user ``` -------------------------------- ### Use Entry Facade Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/entry-repository.md Import the Entry facade to access its methods for managing entries. ```php use Statamic\Facades\Entry; ``` -------------------------------- ### Set default module installation Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Use default: true to ensure the module is selected by default during non-interactive installations. ```yaml modules: seo: default: true dependencies: - statamic/seo-pro ``` -------------------------------- ### Navigation Configuration Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/navigation.md Example configuration file for a footer navigation, defining the title, max depth, and allowed collections. ```yaml # content/navigation/footer.yaml title: Footer max_depth: 3 collections: - pages - posts - documents ``` -------------------------------- ### Update Starter Kit via Composer Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/updating-a-starter-kit.md Use this command to update the starter kit dependency in your project. You can update all dependencies or a specific starter kit. ```shell composer update ``` ```shell composer update vendor/starter-kit-name ``` -------------------------------- ### Create a build script for Vercel deployment Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/vercel.md This shell script installs PHP and Composer dependencies, generates an application key, and triggers the static site generation process. ```bash #!/bin/sh # Install PHP & WGET dnf clean metadata dnf install -y php8.3 php8.3-{common,mbstring,gd,bcmath,xml,fpm,intl,zip} dnf install -y wget # INSTALL COMPOSER EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ] then >&2 echo 'ERROR: Invalid installer checksum' rm composer-setup.php exit 1 fi php composer-setup.php --quiet rm composer-setup.php # INSTALL COMPOSER DEPENDENCIES php composer.phar install # GENERATE APP KEY php artisan key:generate # BUILD STATIC SITE php please stache:warm -n -q php please ssg:generate ``` -------------------------------- ### Date Variable Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/is_future.md These are example date variables used in the Antlers and Blade snippets to demonstrate the `is_future` modifier. ```yaml date: October 21 2015 another_date: November 2030 ``` -------------------------------- ### Create and Use a New Markdown Parser Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/markdown.md Instantiate a new parser with optional configuration and extensions, then use it to parse Markdown content. ```php Markdown::makeParser($config) ->withAutoLinks() ->addExtensions(...) ->parse('# Heading'); ``` -------------------------------- ### Product Entry with Relationships Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/relationships.md Example of a product entry's front-matter, demonstrating how relationships are defined using IDs or handles for photo, author, and related products. ```yaml # /content/products/wayne-gretzky-pog-collection.md title: Wayne Gretzky Pog Collection price: 2495.00 template: products.show id: 123-1234-12-4321 photo: products/gretzky-pogs-FINAL-(2).jpg author: abc-abcd-ab-dcba related_products: - 789-7890-78-0987 - abc-1234-bc-4eba ``` -------------------------------- ### Bundling Composer Dependencies Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/creating-a-starter-kit.md Specify Composer packages to include in the Starter Kit by adding them to the dependencies array in starter-kit.yaml. ```yaml dependencies: - statamic/ssg ``` -------------------------------- ### Install Laravel Horizon Source: https://github.com/statamic/docs/blob/6.x/content/collections/troubleshooting/email-not-sending.md If using Laravel Horizon, ensure it is installed correctly via the Artisan command after composer require. ```shell artisan horizon:install ``` -------------------------------- ### Install AWS Flysystem Adapter Source: https://github.com/statamic/docs/blob/6.x/content/collections/tips/digital-ocean-spaces-for-asset-container.md Install the necessary Flysystem adapter for AWS S3 compatibility, which is required for DigitalOcean Spaces. ```shell composer require league/flysystem-aws-s3-v3 ``` -------------------------------- ### Install Tailwind CSS Dependencies Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/vite-tooling.md Installs `tailwindcss` and `@tailwindcss/vite` npm packages required for using Tailwind CSS in your addon. ```sh npm install tailwindcss @tailwindcss/vite ``` -------------------------------- ### Example Console Output Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/console_log.md This is an example of the output you might see in your browser's JavaScript console after using the console_log modifier. ```javascript ["apples", "banana", "jerky"] ``` -------------------------------- ### Boot service provider logic Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/lifecycle.md The boot method is used for executing bootstrapping logic after all services are registered. ```php public function boot() { // } ``` -------------------------------- ### Sanitizing GET Variables in Blade Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/get.md Sanitize GET variables in Blade using the `Statamic::modify` helper for secure output. ```blade {{ request()->get('jeggings') }} -- or -- {!! Statamic::modify(request()->get('jeggings'))->sanitize() !!} ``` -------------------------------- ### Define Sites in resources/sites.yaml Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/multi-site.md Configure multiple sites by defining their handles, names, URLs, and locales in the sites configuration file. ```yaml default: name: First Site url: / locale: en_US second: name: Second Site url: /second/ locale: en_US ``` -------------------------------- ### Example with a date variable Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/weeks_ago.md This example shows how to use the 'weeks_ago' modifier with a date variable. The date is set to 'October 1 2015'. ```html {{ test_date | weeks_ago }} ``` -------------------------------- ### Import Site Facade Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/site-repository.md Import the Site facade to access its methods. ```php use Statamic\Facades\Site; ``` -------------------------------- ### Lcfirst Modifier Output Example Source: https://github.com/statamic/docs/blob/6.x/content/collections/modifiers/lcfirst.md This example demonstrates the expected output after applying the `lcfirst` modifier to a string that begins with an uppercase letter. ```html wow ``` -------------------------------- ### Navigation Tree API Query Parameters Source: https://github.com/statamic/docs/blob/6.x/content/collections/pages/rest-api.md Example URL demonstrating parameters for selecting fields, limiting depth, and specifying a site for the navigation tree endpoint. ```url /api/navs/{nav}/tree?fields=title,url&max_depth=2&site=fr ``` -------------------------------- ### Accessing GET Variables with Blade Source: https://github.com/statamic/docs/blob/6.x/content/collections/variables/get.md Retrieve GET parameters using Blade syntax, either directly or via the `request()` helper. ```blade {{ $get['show'] ?? '' }} -- or -- {{ request()->get('show') }} ``` -------------------------------- ### Import Asset Facade Source: https://github.com/statamic/docs/blob/6.x/content/collections/resource_apis/asset-repository.md Include this statement at the beginning of your PHP file to use the Asset Facade. ```php use Statamic\Facades\Asset; ```