Download the PHP package statamic/static-site-generator without Composer

On this page you can find all versions of the php package statamic/static-site-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package static-site-generator

Statamic Static Site Generator

Generate static sites with Statamic.

Installation

You can install the Static Site Generator package with the following command:

The command will install the statamic/ssg package via Composer, optionally publish the configuration file and prompt you if you wish to install the spatie/fork package for running multiple workers.

Usage

Run the following command:

Your site will be generated into a directory which you can deploy however you like. See Deployment Examples below for inspiration.

Multiple Workers

For improved performance, you may spread the page generation across multiple workers. This requires Spatie's Fork package. Then you may specify how many workers are to be used. You can use as many workers as you have CPU cores.

Routes

Routes will not automatically be generated. You can add any additional URLs you wish to be generated by adding them to the urls array in the config file.

You can also exclude single routes, or route groups with wildcards. This will override anything in the urls config.

Dynamic Routes

You may add URLs dynamically by providing a closure that returns an array to the addUrls method.

Pagination Routes

Wherever pagination is detected in your antlers templates (eg. if you use the paginate param on the collection tag), multiple pages will automatically be generated with /articles/page/2 style urls.

You may configure a custom routing style in config/statamic/ssg.php:

Post-generation callback

You may optionally define extra steps to be executed after the site has been generated.

Glide Images

The default configuration of Statamic is to have Glide use "dynamic" images, which means that the glide tag will only output URLs. The images themselves will be generated when the URLs are visited. For a static site, this no longer makes sense since it will typically be deployed somewhere where there is no dynamic Glide route available.

By default, the SSG will automatically reconfigure Glide to generate images into the img directory whenever glide tags are used. This is essentially Glide's custom static path option.

You can customize where the images will be generated:

If you are using a custom glide disk, you can tell the SSG to leave it alone:

And then copy the images over (or create a symlink) after generating has completed:

Triggering Command Failures

If you are using the SSG in a CI environment, you may want to prevent the command from succeeding if any pages aren't generated (e.g. to prevent deployment of an incomplete site).

By default, the command will finish and exit with a success code even if there were un-generated pages. You can tell configure the SSG to fail early on errors, or even on warnings.

Deployment Examples

These examples assume your workflow will be to author content locally and not using the control panel in production.

Deploy to Netlify

Deployments are triggered by committing to Git and pushing to GitHub.

After your site has an APP_URL...

Finally, generate an APP_KEY to your .env file locally using php artisan key:generate and copy it's value, then...

S3 Asset Containers

If you are storing your assets in an S3 bucket, the .envs used will need to be different to the defaults that come with Laravel, as they are reserved by Netlify. For example, you can amend them to the following:

Be sure to also update these in your s3 disk configuration:

Deploy to Vercel

Deployments are triggered by committing to Git and pushing to GitHub.

Code for build.sh

Add the following snippet to build.sh file to install PHP, Composer, and run the ssg:generate command:

Deploy to Surge

Prerequisite: Install with npm install --global surge. Your first deployment will involve creating an account via command line.

Deploy to Firebase hosting

Prerequisite: Follow the instructions to get started with Firebase hosting


All versions of static-site-generator with dependencies

PHP Build Version
Package Version
Requires statamic/cms Version ^5.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package statamic/static-site-generator contains the following files

Loading the files please wait ....