Locations
in package
This class provides utility access to most of Spitfire's most common paths, including the current working directory, the root directory of spitfire, the vendor directory and the different locations of each application that is active.
All directories must be returned with a trailing slash to ensure consistent behavior across different apps.
Table of Contents
- config() : string
- The config path should contain configuration files that the system can load to make decisions based on the preferences the operator has determined.
- public() : string
- Returns a path to the public folder (or a selected path within it). Files in this location can be served by the web-server.
- publicStorage() : string
- The public storage folder returns a location to storage that the system provides within the scope of the webserver's document root. This means that files placed here will be accessible by users without the need for credentials or anything similar.
- resources() : string
- The resources folder contains uncompiled assets, templates, locales, etc that the system can use to enrich the experience of the user.
- root() : string
- Returns the path of the root directory of spitfire.
- spitfire() : string
- Returns the location of the spitfire installation. Most spitfire installations do not need to have access to the location of the framework.
- storage() : string
- The storage folder allows the application to determine where it should place files within the server. Files placed here are not accessible by the users without code that exposes them.
- working() : string
- Returns the current working directory for the application. This will determine how the system looks up files.
Methods
config()
The config path should contain configuration files that the system can load to make decisions based on the preferences the operator has determined.
public
config([string $path = '' ]) : string
Parameters
- $path : string = ''
-
A path to locate within the folder [optional]
Return values
string —public()
Returns a path to the public folder (or a selected path within it). Files in this location can be served by the web-server.
public
public([string $path = '' ]) : string
Parameters
- $path : string = ''
Return values
string —publicStorage()
The public storage folder returns a location to storage that the system provides within the scope of the webserver's document root. This means that files placed here will be accessible by users without the need for credentials or anything similar.
public
publicStorage([string|null $path = '' ]) : string
Parameters
- $path : string|null = ''
Return values
string —resources()
The resources folder contains uncompiled assets, templates, locales, etc that the system can use to enrich the experience of the user.
public
resources([string $path = '' ]) : string
Parameters
- $path : string = ''
Return values
string —root()
Returns the path of the root directory of spitfire.
public
root([string $path = '' ]) : string
Parameters
- $path : string = ''
-
[optional]
Return values
string —spitfire()
Returns the location of the spitfire installation. Most spitfire installations do not need to have access to the location of the framework.
public
spitfire([string $path = '' ]) : string
Parameters
- $path : string = ''
-
A path to locate within the folder [optional]
Return values
string —The location of the spitfire installation
storage()
The storage folder allows the application to determine where it should place files within the server. Files placed here are not accessible by the users without code that exposes them.
public
storage([string|null $path = '' ]) : string
Parameters
- $path : string|null = ''
Return values
string —working()
Returns the current working directory for the application. This will determine how the system looks up files.
public
working([string $path = '' ]) : string
The working directory is not always the directory that contains the files of the application. Here are two examples:
-
php console ...// Working directory == application root -
cd /files; php /myapp/console ...// Working directory =/= application root
Whenever working with the application's file you should use root(). When letting the user define a set of files to work with or a directory to write to, you should use the working directory.
Parameters
- $path : string = ''
-
A path to locate within the folder [optional]