Documentation

Application

Interfaces, Classes and Traits

InitScriptInterface
AppAssetsInterface
The app assets interface enforces a pattern in which applications must be able to locate an asset for their operation, and they must be able to list all the assets they need to operate.
KernelInterface
The kernel interface allows to define standard behaviors that a kernel must implement to get booted and be able to execute the way it's intended
LockFactoryInterface
LockInterface
This interface allows application components to implement locking for spitfire, generally we lock using files, but we could also use other mechanisms like remote servers, databases or semaphores.
MediaManipulatorInterface
SessionHandlerInterface
SeekableStreamInterface
StreamInterface
StreamReaderInterface
StreamSourceInterface
StreamTargetInterface
StreamWriterInterface
AdapterInterface
An adapter is basically a simple block that contains receives and delivers data both to the user and the database. This turns it into a great tool to sanitize user data and prepare information from the DB in a way that it's user friendly.
DirectoryInterface
DriverInterface
This class determines what behaviors a blob storage needs to define to be compatible with Spitfire.
EmbedInterface
FileInterface
MountPointInterface
NodeInterface
ValidationRule
Classes implementing this one indicate their ability to test a variable and verify that it's contents are according to what was expected.
LoadCluster
LoadConfiguration
ProvidersFromManifest
ProvidersInit
The init script of any servive provider allows it to use the components that it registered (and potentially the ones other components registered) to make the component work.
ProvidersRegister
This init script allows our application to register all the service providers' services that we need in order to make the component they provide work properly.
App
Spitfire Application Class. This class is the base of every other 'app', an app is a wrapper of controllers (this allows to plug them into other SF sites) that defines a set of rules to avoid collisions with the rest of the apps.
AppCollection
The app collection is intended to provide spitfire with a good mechanism to look up applications by either class path or url.
AppManifest
The app manifest object contains information that the user can define by adding a manifest file to the project. Currently, the only way to add manifest information to a project is through composer.json
AppNotFoundException
This exception is raised whenever Spitfire has been unable to locate an app.
Cluster
A cluster is a collection of applications that this spitfire instance is managing.
NamespaceMapping
RecursiveAppAssetLocator
The recursive app asset locator does exactly this. It iterates over a folder that the application specified and list all the assets.
ManifestCacheBuildDirector
The director allows an application to register a command that should be able to be invoked via CLI.
ComposerReader
This class extracts manifest data from composer.json and allows the application to assemble an application booststrap object that it can then cache and use to get the application running.
Configuration
Configuration contains an array of data parsed from a configuration file (or multiple, in the event of the configuration referring to a directory that contains configuration files).
BuildConfigurationDirector
The director allows an application to register a command that should be able to be invoked via CLI.
Environment
The environment loads settings from an ini file, and from the system's environment, making them accessible to the application.
Event
En event wraps a event name and a payload. The payload contains additional information about the event.
EventDispatcher
The event dispatcher acts as the central hub where event listeners are hosted and where events are sent. The event dispatcher can be used in two notable ways:
Listener
A listener is a very simple class that contains an event name and an action.
MutableEvent
Mutable events allow the plugins to modify the payload of the event, providing the application with the ability to override the payload.
FailureException
A failure exception is a standard exception that is thrown when the application wishes to report a failure to the user. This is a very generic type, and should whenever possible be replaced by more specific issues that allow the application to attempt to resolve the issue or give further details to the end-user.
Headers
The headers file allows an application to manipulate the headers of the response before sending them to the client.
CORS
Cross-Origin-Resource-Sharing allows the application to determine whether a user agent referred from another server can access a resource on this server and which parameters the HTTP request may have.
LanguageAccept
The language accept class retrieves information from a user's browser and returns it in an organized manner so that the application can properly localize itself to serve the user properly.
LanguageAcceptParser
This parser allows an application to determine what language it should use to answer a request. To do so, it reads the Accept-Language header from a browser's request.
ClosureResponseRequestHandler
The closure request handler is basically a message, it contains a closure and a set of parameters to pass to the closure so it can be executed and the response retrieved from the result.
DecoratingRequestHandler
The decorating request handler allows to bind middleware to another request handler, effectively stacking them together.
RouterActionRequestHandler
The router action handler allows the application to map a route to an action within a controller. This generates a request handler that will use the route to extract parameters and appropriately invoke the action.
RouterClosureRequestHandler
StaticResponseRequestHandler
URL
This dynamically generates system urls this allows us to validate URLs if needed or generate different types of them depending on if pretty links is enabled
ConsoleKernel
The console kernel provides mechanisms to allow a user to interact with the application via the command line interface.
CommandNotFoundException
This type of exception is raised whenever the application is unable to locate the appropriate command for a user's request.
WebKernel
The web kernel allows the application to interact with a web server and to select a controller that will provide an adequate response to the request.
Locations
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.
Request
The request class is a component that allows developers to retrieve information about data that usually is delivered by the webserver. For example, get and post data are usually stored by this object in order to allow your app to use it.
Publisher
The publisher provides the application with the ability to register files that should get merged into the main repository of the application so that resources can be :
PublisherDirector
The director allows an application to register a command that should be able to be invoked via CLI.
Response
Any HTTP response is built off a set of headers and a body that contains the message being delivered. This class represents an HTTP response that can be sent by the application.
Parameters
The parameters a route reads out of a server or URI. This allows the application to gracefully manage the parameters and give them over to the callback function that should replace it.
RewriteRule
A route is a class that rewrites a URL path (route) that matches a route or pattern (old_route) into a new route that the system can use (new_route) to handle the current request.
Routable
The routable class is the base class for both routers and router servers, which can both accept routes and store them. In order to do so, there is a predefined set of functions that are meant to be kept the way they are and a single abstract one that adds the route to the element the way this one decides.
Route
A route is a class that rewrites a URL path (route) that matches a route or pattern (old_route) into a new route that the system can use (new_route) to handle the current request.
Router
Routers are tools that allow your application to listen on alternative urls and attach controllers to different URLs than they would normally do. Please note that enabling a route to a certain controller does not disable it's canonical URL.
RouterResult
The router result object is returned when a route matches (or not) a request.
RoutingMiddleware
The routing middleware is one of the central components of Spitfire, it allows the application to receive the request, and produce a response based on the routes that the developers designed for the application.
URIPattern
The URIPattern class is a wrapper to gather several patterns and test them simultaneously.
Provider
A provider simply provides two methods that allow the application to register services with the container, and to initialize the services after they have been loaded.
LongParamExtractor
DataURI
Filesize
Get
This class is meant to wrap around the _GET array. This allows Spitfire to register read and write data of your application for canonicalization of URLs.
dateTimePicker
HTMLDiv
HTMLElement
HTMLForm
HTMLInput
HTMLLabel
HTMLOption
HTMLSelect
HTMLSpan
HTMLTable
HTMLTableRow
HTMLTextArea
HTMLUnclosedElement
FileLock
FileLockFactory
LockUnavailableException
EncoderUnavailableException
FFMPEGManipulator
GDManipulator
ImagickManipulator
MediaDispatcher
PNGQuant
Post
I currently have no use for this class beyond the idea of parsing several different POST input formats and that's it.
FileSessionHandler
MemcachedSessionHandler
Session
The Session class allows your application to write data to a persistent space that automatically expires after a given time. This class allows you to quickly and comfortably select the persistence mechanism you want and continue working.
SessionHandler
SessionProvider
A provider simply provides two methods that allow the application to register services with the container, and to initialize the services after they have been loaded.
SimpleStackTracePrinter
This class provides Spitfire with tools to print a pretty and informative Stack trace of the error it received.
StackTracePrinter
This class provides Spitfire with tools to print a pretty and informative Stack trace of the error it received.
Stream
StreamSegment
The stream segment class allows an application to restrict access to a stream to a specific segment of it.
View
The view class allows to pass a filename and a set of data for the system to generate a string containing the generated html for the view.
Upload
This class merges the file Uploads coming from a client into the POST array, allowing beans and programmers to have easier access to the data coming from the client without trading in any security.
XSSToken
BaseAdapter
This base adapter allows overriding methods to let it handle the actual getting, setting and sync tasks to this base adapter. Allowing them to reduce duplicate code from the actual returning and storing data and focusing on their tasks.
BooleanAdapter
This adapter allows to verify that data that is inside the adapter is boolean only. You can set whatever data you want but the adapter will just keep it's boolean conversion.
BridgeAdapter
ChildrenAdapter
Children refers to all models that refer to another (parent) model. This allows to manage Relational databases like they're documents.
DateTimeAdapter
This class creates an interface between the usual database's string or integer based approach to an object oriented one that allows building apps easier.
EnumAdapter
This adapter is in charge of ensuring that only values that are inside the range defined by the field are stored. If the user tries to set data that is not valid the adapter will throw an exception.
FloatAdapter
This adapter is in charge of ensuring that only integers reach the database channeled through it. So, whenever the user sets data to it we will perform a check to see if it's Integer data. Otherwise they'll get an exception.
IntegerAdapter
This adapter is in charge of ensuring that only integers reach the database channeled through it. So, whenever the user sets data to it we will perform a check to see if it's Integer data. Otherwise they'll get an exception.
ManyToManyAdapter
This adapter allows the user to access Many to many relations inside the database as if it was an array with sorted data. This makes it easy to iterate over records or do actions on them. Please note that some of the actions performed on this records are very database intensive and are therefore to be used with care.
ReferenceAdapter
The reference adapter allows models to provide models for objects that are just referenced. This prevents the user from having to resolve IDs manually.
StringAdapter
This adapter allows any data type that uses strings to interact directly with the string fields inside the database. Nothing is done inside this adapter.
ChildrenField
The children field allows the application to maintain a relationship in the database that acts like an array of models that depend on the current model.
Field
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
BooleanField
This class represents a column in the database capable of holding boolean data.
DatetimeField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
EnumField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
FileField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
FloatField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
IntegerField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
ManyToManyField
Reference
Elements of this class indicate a connection between two Models, this allows spitfire to let you use relational databases just like they were objects (connected to each other). While real elements are scattered around tables in no apparent manner.
StringField
Represents a table's field in a database. Contains information about the table the field belongs to, the name of the field and if it is (or not) a primary key or auto-increment field.
TextField
Represents a field holding a big chunk of text. The essential difference between those is the way they are stored in the database and requested from the user.
Index
An Index allows your application to define a series of fields that the DBMS should index in order to improve performance of data retrieval.
OTFModel
This class allows to track changes on database data along the use of a program and creates interactions with the database in a safe way.
ReflectionParameterTransformer
This class allows different components to reuse the logic the database has to create parameters for different functions/methods.
Model
This class allows to track changes on database data along the use of a program and creates interactions with the database in a safe way.
Controller
This class just ensures that applications have controllers that are explicitly designed to be served publicly. If your controller does not extend this class, Spitfire will deny access to any requests headed it's way.
Director
The director allows an application to register a command that should be able to be invoked via CLI.
Invoke
This class will autoinclude functions the application needs to run and return the result
MaintenanceMiddleware
The maintenance middleware allows Spitfire to provide a maintenance mode, if the administrator creates the file `.maintenance` containing information for the user, the maintenance mode will fire an exception that will prevent execution from continuing and try to fetch a user error page for the maintenance mode.
RangedRequestMiddleware
The ranged request middleware allows an application requesting data from our application to indicate that they wish to only receive a part of the response.
SynchronizedMiddleware
ValidationMiddleware
DirectorProvider
The director provider class registers the commands that spitfire provides to applications using it.
plugin
registry
This class is basically an Array cache, this means that you can define stuff to use it later.
m3w_parser
This allows us to parse and obtain data from .m3w containers.
SpitFire
Dispatcher class of Spitfire. Calls all the required classes for Spitfire to run.
Paginator
This class is the base for the database query pagination inside of Spitfire.
Directory
Driver
FilePermissionsException
File
FileStreamReader
FileStreamWriter
MountPoint
Blob
DriveDispatcher
IOStream
CheckStoragePermissionsDirector
The director allows an application to register a command that should be able to be invoked via CLI.
DotNotationAccessor
The dot notation accessor allows applications to access nested arrays by using a simple string with dots for separators. It also provides the ability to access the data without having to check intermediate steps
AssumeTest
ConfigurationTest
EnvironmentTest
PublisherTest
FailTest
HeadersTest
LanguageAcceptParserTest
GetTest
WEBPManipulationTest
This tests Spitfire's ability to handle WEBP files, which are an image format developed by Google to reduce the bandwidth and storage requirements of images while maintaining a good level of detail.
StreamSegmentTest
TestController
RouterNestedTest
RouterTest
DriveTest
NewDriveTest
StringTest
DotNotationAccessorTest
URLTest
ParserTest
InArrayTest
DatabaseExportDirector
The database director allows to use the models to quickly create the database schema on the DBMS, and import and export data from the DBMS to a File system.
DatabaseImportDirector
The database director allows to use the models to quickly create the database schema on the DBMS, and import and export data from the DBMS to a File system.
DatabaseInitDirector
The database director allows to use the models to quickly create the database schema on the DBMS, and import and export data from the DBMS to a File system.
Strings
Parser
This parser allows a developer to configure the application to validate the incoming data using expressions inside the docblocks (or any similar mechanism)
ParserException
BaseRule
ClosureValidationRule
This rule tests values against a provided function that checks whether the data it will receive later is valid.
EmptyValidationRule
Validates a value is not empty. This allows the system to make sure that a required field has not been field with useless data.
FilterValidationRule
A filter based validation rule allows you to use premade PHP filters to validate your content. Please note that a filter that sanitizes may cause unwanted behavior or unexpected ones.
InValidationRule
Validates that the length of a content is smaller than the indicated minimum length. This validates only data as strings which may cause unexpected behavior if you try to test the length of an array.
LengthValidationRule
Validates that the length of a content is smaller than the indicated minimum length. This validates only data as strings which may cause unexpected behavior if you try to test the length of an array.
MaxLengthValidationRule
Validates that the length of a content is smaller than the indicated minimum length. This validates only data as strings which may cause unexpected behavior if you try to test the length of an array.
MinLengthValidationRule
Validates that the length of a content is bigger than the indicated minimum length. This validates only data as strings which may cause unexpected behavior if you try to test the length of an array.
NotValidationRule
Validates that the length of a content is smaller than the indicated minimum length. This validates only data as strings which may cause unexpected behavior if you try to test the length of an array.
PositiveNumberValidationRule
This filter ensures that a number provided to it was positive.
RegexValidationRule
Validates a value is not empty. This allows the system to make sure that a required field has not been field with useless data.
TypeNumberValidationRule
TypeStringValidationRule
ValidationRuleGroup
Validation groups allow an application to use several different criteria to create complex validation schemes that would otherwise require writing complex rules or if statements.
ValidationError
Represents an error detected while validating an element. This class contains information to aid a user of the system to solve the errors encountered and generating a valid input that is useful.
ValidationException
Validation exceptions are generated after a value for data has been tested and it has been deemed as faulty. If this happens all errors gathered will be attached to this Exception and thrown to the application.

Table of Contents

spitfire()  : SpitFire
This is a quick hand method to use Spitfire's main App class as a singleton.
app()  : App
Registers a new Application in Spitfire, allowing it to handle requests directed to it.
boot()  : KernelInterface
Ths function will boot a kernel, instancing it and executing the necessary scripts to initialize it.
assume()  : void
Raises an exception whenever the application runs into an scenario that was not expected. This function functions in a very similar manner to an assertion (with the exception of this being executed in production).
fail()  : void
This function allows the developer to stop the execution of the application.
db()  : DB
Shorthand function to create / retrieve the model the application is using to store data. We could consider this a little DB handler factory.
view()  : StreamInterface
Creates a view. This function will automatically locate the appropriate file containing the template for the view, generate a template and render it to generate a response.
response()  : Response
This function provides a shorthand way of creating a response to a request, this is very useful in combination with the view() function, allowing you to respond from a controller with something like this:
_q()  : type
Escapes quotes from HTML. This will replace both ' and " with ' and " respectively. This does not escape the other HTML entities, for that refer to _e();
_e()  : string
Escapes the HTML from a string. This function will not escape the quotes, please refer to the _q wrapper for that.
_u()  : string
Helper to convert URLs in text to actual links. By default, the application will translate the URL to a pure HTML link, but you can pass a callable to the system to change the output.
__()  : string
Returns HTML escaped string and if desired it adds ellipsis. If the string is numeric it will reduce unnecessary decimals.
_t()  : string|DomainGroup
Translation helper.
console()  : mixed
validate()  : void
Tests a value against a provided set of rules, if the
getPathInfo()  : string
Retrieves the current path from the request. This will retrieve the path without query string or document root.
_def()  : mixed
collect()  : Collection
This function is a shorthand for "new Collection" which also allows fluent usage of the collection in certain environments where the PHP version still limits that behavior.
url()  : mixed
Creates a new URL. Use this class to generate dynamic URLs or to pass URLs as parameters. For consistency (double base prefixes and this kind of misshaps aren't funny) use this object to pass or receive URLs as paramaters.
clamp()  : number
The clamp function is a math function that receives three arguments, a minimum, a bias and a maximum. Clamp will either return the bias or the closest value whenever the bias is outside the range of maximum and minimum.
within()  : number
This is the deprecated naming for the clamp function.
media()  : mixed
storage()  : DriveDispatcher|NodeInterface
mime()  : mixed
event()  : EventDispatcher
Allows the application to manage a central event dispatching system, instead of relying on every component to build a custom one. If your component doesn't wish to share it's hooks and plugins please @see Target
lock()  : FileLockFactory
asset()  : string
defer()  : void
Convenience method for accessing the TaskFactory for deferring tasks. You can pass a task class to be deferred, a bunch of settings and a time to execute this task at.
config()  : mixed
Returns an application configuration. Note that configuration in Spitfire is tiered, configuration and environments.
env()  : string|null
This function should ONLY be invoked from the config files. This data is not cached, and therefore not always available during runtime.
cli()  : bool
Allows the application to reliably determine whether it is running in a console or on a web server environment.

Functions

spitfire()

This is a quick hand method to use Spitfire's main App class as a singleton.

spitfire() : SpitFire

It allows you to quickly access many of the components the framework provides to make it easier to read and maintain the code being created.

Tags
staticvar

type $sf

Return values
SpitFire

app()

Registers a new Application in Spitfire, allowing it to handle requests directed to it.

app(string $name, string $namespace) : App
Parameters
$name : string

The name of the Application

$namespace : string

The namespace in which the requests will be sent to the application.

Return values
App

The App created by the system, use this to pass parameters and configuration to the application.

boot()

Ths function will boot a kernel, instancing it and executing the necessary scripts to initialize it.

boot(class-string<\KernelInterface> $kernel) : KernelInterface
Parameters
$kernel : class-string<\KernelInterface>

The name of the kernel to boot

Tags
throws
ApplicationException
Return values
KernelInterface

assume()

Raises an exception whenever the application runs into an scenario that was not expected. This function functions in a very similar manner to an assertion (with the exception of this being executed in production).

assume(bool $condition, string|Closure|Exception $failure) : void

The second parameter contains the name of the exception to be raised on failure, an exception instance or a closure to be executed, which should then either end execution or throw an exception itself.

This is intended to reduce the boilerplate on code that looks like this: if (!$condition) { throw new Exception(); }

The code becomes a bit more readable and drops the negation, making it look like this: assume($condition, Exception::class);

Overall reducing the strain of visually analyzing the code.

Parameters
$condition : bool

If the condition is true, the code will continue being executed

$failure : string|Closure|Exception
Return values
void

fail()

This function allows the developer to stop the execution of the application.

fail(int $status[, string $message = '' ]) : void

It raises a failure exception that will prevent the code from continuing and display a message to the end user that explains the situation.

Whenever your application runs into a more specific issue, you should avoid using this and instead raise a custom exception that offers the user support to resolve the issue or additional information.

Parameters
$status : int
$message : string = ''
Tags
throws
FailureException
Return values
void

db()

Shorthand function to create / retrieve the model the application is using to store data. We could consider this a little DB handler factory.

db() : DB
Return values
DB

view()

Creates a view. This function will automatically locate the appropriate file containing the template for the view, generate a template and render it to generate a response.

view(string|null $identifier, array<string|int, mixed> $data) : StreamInterface

Right now it does a very simplistic job, intializing a pug engine that will allow us to generate an output.

Parameters
$identifier : string|null
$data : array<string|int, mixed>
Tags
todo

Future iterations should accept a templating engine other than pug

todo

Future revisions should return the template so changes can be made

Return values
StreamInterface

response()

This function provides a shorthand way of creating a response to a request, this is very useful in combination with the view() function, allowing you to respond from a controller with something like this:

response(StreamInterface $stream[, int $code = 200 ][, array<string|int, array<string|int, string>> $headers = [] ]) : Response

return response(view('home'));

Or something along the lines of:

`return response(view('notfound'), 404);

Parameters
$stream : StreamInterface
$code : int = 200
$headers : array<string|int, array<string|int, string>> = []
Return values
Response

_q()

Escapes quotes from HTML. This will replace both ' and " with &#039; and &quot; respectively. This does not escape the other HTML entities, for that refer to _e();

_q(type $str) : type

Usually you should use this function like _q(_e($str));

Parameters
$str : type
Return values
type

_e()

Escapes the HTML from a string. This function will not escape the quotes, please refer to the _q wrapper for that.

_e(string $str) : string
Parameters
$str : string
Tags
see
_q()
Return values
string

_u()

Helper to convert URLs in text to actual links. By default, the application will translate the URL to a pure HTML link, but you can pass a callable to the system to change the output.

_u(string $str[, Closure|callable $cb = null ]) : string
Parameters
$str : string
$cb : Closure|callable = null
Return values
string

__()

Returns HTML escaped string and if desired it adds ellipsis. If the string is numeric it will reduce unnecessary decimals.

__(string $str[, int $maxlength = false ]) : string
Parameters
$str : string
$maxlength : int = false
Return values
string

_t()

Translation helper.

_t() : string|DomainGroup

Depending on the arguments this function receives, it will have one of several behaviors.

If the first argument is a spitfire\locale\Locale and the function receives a optional second parameter, then it will assign the locale to either the global domain / the domain provided in the second parameter.

Otherwise, if the first parameter is a string, it will call the default locale's say method. Which will translate the string using the standard locale.

If no parameters are provided, this function returns a DomainGroup object, which provides access to the currency and date functions as well as the other domains that the system has for translations.

Return values
string|DomainGroup

console()

console() : mixed
Return values
mixed

validate()

Tests a value against a provided set of rules, if the

validate(mixed $value, mixed $rules) : void
Parameters
$value : mixed
$rules : mixed
Return values
void

_def()

_def(mixed &$a, mixed $b) : mixed
Parameters
$a : mixed
$b : mixed
Return values
mixed

collect()

This function is a shorthand for "new Collection" which also allows fluent usage of the collection in certain environments where the PHP version still limits that behavior.

collect([mixed $elements = [] ]) : Collection
Parameters
$elements : mixed = []
Return values
Collection

url()

Creates a new URL. Use this class to generate dynamic URLs or to pass URLs as parameters. For consistency (double base prefixes and this kind of misshaps aren't funny) use this object to pass or receive URLs as paramaters.

url() : mixed

Please note that when passing a URL that contains the URL as a string like "/hello/world?a=b&c=d" you cannot pass any other parameters. It implies that you already have a full URL.

You can pass any amount of parameters to this class, the constructor will try to automatically parse the URL as good as possible.

  • Arrays are used as _GET
  • App objects are used to identify the namespace
  • Strings that contain / or ? will be parsed and added to GET and path
  • The rest of strings will be pushed to the path.
Return values
mixed

clamp()

The clamp function is a math function that receives three arguments, a minimum, a bias and a maximum. Clamp will either return the bias or the closest value whenever the bias is outside the range of maximum and minimum.

clamp(number $min, number $bias, number $max) : number

The first and the last parameter delimit the range. The second parameter is the bias being tested.

within(1, 50, 100); //Outputs: 50 within(1, 500, 100); //Outputs: 100 within(1, -50, 100); //Outputs: 1

Parameters
$min : number
$bias : number
$max : number
Return values
number

within()

This is the deprecated naming for the clamp function.

within(number $min, number $val, number $max) : number
Parameters
$min : number
$val : number
$max : number
Tags
deprecated

since version 0.1-dev 2020-09-29

see
clamp
Return values
number

media()

media() : mixed
Return values
mixed

storage()

storage() : DriveDispatcher|NodeInterface
Tags
staticvar

type $dispatcher

Return values
DriveDispatcher|NodeInterface

mime()

mime(mixed $file) : mixed
Parameters
$file : mixed
Return values
mixed

event()

Allows the application to manage a central event dispatching system, instead of relying on every component to build a custom one. If your component doesn't wish to share it's hooks and plugins please @see Target

event([Event $event = null ]) : EventDispatcher
Parameters
$event : Event = null
Tags
staticvar

\spitfire\core\event\EventDispatcher $dispatcher

Return values
EventDispatcher

asset()

asset(string $name[, string $scope = 'assets/' ]) : string
Parameters
$name : string
$scope : string = 'assets/'

A directory to scope this to. If an application builds it's own assets and generates a manifest file, it will be located here. The mix-manifest file is required to be located in the root of this directory.

Note that the scope must be relative to the public directory, if this is not the case, the system will generate bad URLs or fail to locate the manifests.

If, for example, your application publishes it's assets to the assets/vendor/myapp older within public folder, this is exactly the string it should pass

Return values
string

defer()

Convenience method for accessing the TaskFactory for deferring tasks. You can pass a task class to be deferred, a bunch of settings and a time to execute this task at.

defer(string $task, mixed $options, int $defer[, int $ttl = 10 ]) : void

Please refer to the documentation to enable the daemon required to process the queue.

Parameters
$task : string
$options : mixed
$defer : int
$ttl : int = 10
Tags
staticvar

spitfire\defer\TaskFactory $async

Return values
void

config()

Returns an application configuration. Note that configuration in Spitfire is tiered, configuration and environments.

config(string $key[, mixed $fallback = null ]) : mixed

You as the developer should establish the configuration so the components you add to your application work as expected, and should expose the environment to the person deploying the application so they can customize the behavior.

Parameters
$key : string

The key in the configuration

$fallback : mixed = null

The value to return if the configuration does not contain the key

Return values
mixed

The data for this configuration entry

env()

This function should ONLY be invoked from the config files. This data is not cached, and therefore not always available during runtime.

env(string $param) : string|null

Reads a value from the current environment.

Parameters
$param : string
Return values
string|null

cli()

Allows the application to reliably determine whether it is running in a console or on a web server environment.

cli() : bool
Return values
bool

Search results