Download the PHP package tdwesten/statamic-builder without Composer
On this page you can find all versions of the php package tdwesten/statamic-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tdwesten/statamic-builder
More information about tdwesten/statamic-builder
Files in tdwesten/statamic-builder
Package statamic-builder
Short Description A fluent blueprint and fieldset builder for Statamic.
License MIT
Informations about the package statamic-builder
Statamic Builder
The Statamic Builder speeds up building Statamic sites. It offers a clear method to define sites, blueprints, fieldsets, collections, naviations and taxonomies using PHP classes. This approach enhances code readability and maintainability compared to writing YAML files.
For example, you can define a collection blueprint as follows:
Installation
You can install this addon with composer. Run the following command in your terminal to install the addon.
Blueprints and Fieldsets
This addon allows you to create blueprints and fieldsets in a fluent way. This makes it easier to define and maintain your blueprints and fieldsets.
How to create a blueprint
-
Create a new blueprint by running the following command for a page blueprint for example:
-
Define your blueprint in the generated file. For example:
-
Register the blueprint in your
config/statamic/builder.php
file: - That's it! You can now use your blueprint in your Statamic application.
How to create a fieldset
-
Create a new fieldset by running the following command for a hero fieldset for example:
-
Define your fieldset in the generated file. For example add a title and image field to the hero fieldset:
-
Register the fieldset in your
config/statamic/builder.php
file: - Now you can use your fieldset in your blueprints. For example:
Supported Fieldtypes
All default Statamic field types are supported. You can create custom field types by utilizing the Field
class. For example to create a custom field type you can use the following code:
How to register Collections and Taxonomies
This addon enables you to define collections and taxonomies in PHP classes, simplifying the process of defining and managing them.
How to register a collection
-
Generate a new collection blueprint, for example for an articles collection blueprint run the following command:
-
Define your Articles collection blueprint in the generated file. For example, the file has all options available to define a collection blueprint. For example:
- Add the collection to the
config/statamic/builder.php
file:
How to register a taxonomy
-
Generate a new taxonomy blueprint, for example for a categories taxonomy blueprint run the following command:
-
Define your taxonomy in the generated file. For example, the file has all options available to define a taxonomy. For example:
-
Add the taxonomy to the
config/statamic/builder.php
file:public function title(): string { return 'Site Settings'; }
// Add more options here... } bash php artisan make:site Blog bash php artisan cache:clear
All versions of statamic-builder with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
laravel/framework Version ^10.0|^11.0|^12.0
statamic/cms Version ^5.4