Configuration

Phel comes with some configuration options. They are stored in the phel-config.php file in the root directory of every project.

Structure#

These are all Phel specific configuration options available, along with the values that are set by default.

<?php
// phel-config.php
return (new \Phel\Config\PhelConfig())
    ->setSrcDirs(['src/phel'])
    ->setTestDirs(['tests/phel'])
    ->setVendorDir('vendor')
    ->setOut((new PhelOutConfig())
        ->setDestDir('out')
        ->setMainPhelNamespace('your-ns\main')
        ->setMainPhpFilename('main'))
    ->setExport((new \Phel\Config\PhelExportConfig())
        ->setDirectories(['src/phel'])
        ->setNamespacePrefix('PhelGenerated')
        ->setTargetDirectory('src/PhelGenerated'))
    ->setIgnoreWhenBuilding(['src/phel/local.phel'])
    ->setKeepGeneratedTempFiles(false)
    ->setFormatDirs(['src', 'tests'])
;

Options in detail#

This chapter contains all configuration options explained in detail.

setSrcDirs#

Sets a list of directories in which the source files for the project are located.

setTestDirs#

Sets a list of directories in which the test files are located.

setVendorDir#

Sets the name of the composer vendor directory. Default is vendor.

setOut#

When running the phel build command...

  • DestDir: the directory where all compiled Phel code will be generated.
  • setMainPhelNamespace: the main phel namespace to start compiling the Phel code.
  • setMainPhpFilename: the PHP filename entrypoint.

setExport#

Sets configuration options that are being used for the Phel export command that is described in the PHP Interop chapter. Currently, the export command requires three options:

  • setDirectories: Sets a list of directories in which the export command should search for export functions.
  • setNamespacePrefix: Sets a namespace prefix for all generated PHP classes.
  • setTargetDirectory: Sets the directory where the generated PHP classes are stored.

setKeepGeneratedTempFiles#

A flag that removes automatically all generated temporal files once the command phel run has been executed. Default is false.

setIgnoreWhenBuilding#

Sets a list of Phel files that should be ignored when building the code.

setFormatDirs#

Sets a list of directories whose files will be formatted when running the format command.