fromProject

Learn how to build a provider from the committed content.

This static method builds a provider from the content downloaded with the CLI, reading the configuration and content files from the project directory.

Signature

This method has the following signature:

public static function fromProject(?string $projectDirectory = null): ?self

This method returns a new instance, or null when the content files cannot be located.

Example

Here is a basic example of how to build a provider from the project content:

<?phpuse Croct\Plug\Content\DefaultContentProvider;
$provider = DefaultContentProvider::fromProject();

Parameters

The following list describes the supported parameters:

projectDirectory(optional)
string|null

The directory to read the content files from. The default is null, which uses the root package’s install path.

Default:null