$instances
$instances : array
Cache for instance of any services that have been requested as a "shared" instance.
Services Configuration file.
Services are simply other classes/libraries that the system uses to do its job. This is used by CodeIgniter to allow the core of the framework to be swapped out easily without affecting the usage within the rest of your application.
This is used in place of a Dependency Injection container primarily due to its simplicity, which allows a better long-term maintenance of the applications built on top of CodeIgniter. A bonus side-effect is that IDEs are able to determine what class you are calling whereas with DI Containers there usually isn't a way for them to do this.
autoloader(boolean $getShared = true) : \CodeIgniter\Autoloader\Autoloader
The Autoloader class is the central class that handles our spl_autoload_register method, and helper methods.
boolean | $getShared |
locator(boolean $getShared = true) : \CodeIgniter\Autoloader\FileLocator
The file locator provides utility methods for looking for non-classes within namespaced folders, as well as convenience methods for loading 'helpers', and 'libraries'.
boolean | $getShared |
cache(\Config\Cache $config = null, boolean $getShared = true) : \CodeIgniter\Cache\CacheInterface
The cache class provides a simple way to store and retrieve complex data for later.
\Config\Cache | $config | |
boolean | $getShared |
clirequest(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\HTTP\CLIRequest
The CLI Request class provides for ways to interact with a command line request.
\Config\App | $config | |
boolean | $getShared |
curlrequest(array $options = array(), \CodeIgniter\HTTP\ResponseInterface $response = null, \Config\App $config = null, boolean $getShared = true) : \CodeIgniter\HTTP\CURLRequest
The CURL Request class acts as a simple HTTP client for interacting with other servers, typically through APIs.
array | $options | |
\CodeIgniter\HTTP\ResponseInterface | $response | |
\Config\App | $config | |
boolean | $getShared |
email(null $config = null, boolean $getShared = true) : \CodeIgniter\Email\Email|mixed
The Email class allows you to send email via mail, sendmail, SMTP.
null | $config | |
boolean | $getShared |
encrypter(mixed $config = null, boolean $getShared = false) : \CodeIgniter\Encryption\EncrypterInterface
The Encryption class provides two-way encryption.
mixed | $config | |
boolean | $getShared |
Encryption handler
exceptions(\Config\Exceptions $config = null, \CodeIgniter\HTTP\IncomingRequest $request = null, \CodeIgniter\HTTP\Response $response = null, boolean $getShared = true) : \CodeIgniter\Debug\Exceptions
The Exceptions class holds the methods that handle:
\Config\Exceptions | $config | |
\CodeIgniter\HTTP\IncomingRequest | $request | |
\CodeIgniter\HTTP\Response | $response | |
boolean | $getShared |
filters(mixed $config = null, boolean $getShared = true) : \CodeIgniter\Filters\Filters
Filters allow you to run tasks before and/or after a controller is executed. During before filters, the request can be modified, and actions taken based on the request, while after filters can act on or modify the response itself before it is sent to the client.
mixed | $config | |
boolean | $getShared |
honeypot(\CodeIgniter\Config\BaseConfig|null $config = null, boolean $getShared = true) : \CodeIgniter\Honeypot\Honeypot|mixed
The Honeypot provides a secret input on forms that bots should NOT fill in, providing an additional safeguard when accepting user input.
\CodeIgniter\Config\BaseConfig|null | $config | |
boolean | $getShared |
image(string $handler = null, mixed $config = null, boolean $getShared = true) : \CodeIgniter\Images\Handlers\BaseHandler
Acts as a factory for ImageHandler classes and returns an instance of the handler. Used like Services::image()->withFile($path)->rotate(90)->save();
string | $handler | |
mixed | $config | |
boolean | $getShared |
iterator(boolean $getShared = true) : \CodeIgniter\Debug\Iterator
The Iterator class provides a simple way of looping over a function and timing the results and memory usage. Used when debugging and optimizing applications.
boolean | $getShared |
logger(boolean $getShared = true) : \CodeIgniter\Log\Logger
The Logger class is a PSR-3 compatible Logging class that supports multiple handlers that process the actual logging.
boolean | $getShared |
migrations(\CodeIgniter\Config\BaseConfig $config = null, \CodeIgniter\Database\ConnectionInterface $db = null, boolean $getShared = true) : \CodeIgniter\Database\MigrationRunner
Return the appropriate igration runner.
\CodeIgniter\Config\BaseConfig | $config | |
\CodeIgniter\Database\ConnectionInterface | $db | |
boolean | $getShared |
negotiator(\CodeIgniter\HTTP\RequestInterface $request = null, boolean $getShared = true) : \CodeIgniter\HTTP\Negotiate
The Negotiate class provides the content negotiation features for working the request to determine correct language, encoding, charset, and more.
\CodeIgniter\HTTP\RequestInterface | $request | |
boolean | $getShared |
pager(mixed $config = null, \CodeIgniter\View\RendererInterface $view = null, boolean $getShared = true) : \CodeIgniter\Pager\Pager
Return the appropriate pagination handler.
mixed | $config | |
\CodeIgniter\View\RendererInterface | $view | |
boolean | $getShared |
parser(string $viewPath = null, mixed $config = null, boolean $getShared = true) : \CodeIgniter\View\Parser
The Parser is a simple template parser.
string | $viewPath | |
mixed | $config | |
boolean | $getShared |
renderer(string $viewPath = null, mixed $config = null, boolean $getShared = true) : \CodeIgniter\View\View
The Renderer class is the class that actually displays a file to the user.
The default View class within CodeIgniter is intentionally simple, but this service could easily be replaced by a template engine if the user needed to.
string | $viewPath | |
mixed | $config | |
boolean | $getShared |
request(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\HTTP\IncomingRequest
The Request class models an HTTP request.
\Config\App | $config | |
boolean | $getShared |
response(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\HTTP\Response
The Response class models an HTTP response.
\Config\App | $config | |
boolean | $getShared |
redirectResponse(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\HTTP\Response
The Redirect class provides nice way of working with redirects.
\Config\App | $config | |
boolean | $getShared |
routes(boolean $getShared = true) : \CodeIgniter\Router\RouteCollection
The Routes service is a class that allows for easily building a collection of routes.
boolean | $getShared |
router(\CodeIgniter\Router\RouteCollectionInterface $routes = null, \CodeIgniter\HTTP\Request $request = null, boolean $getShared = true) : \CodeIgniter\Router\Router
The Router class uses a RouteCollection's array of routes, and determines the correct Controller and Method to execute.
\CodeIgniter\Router\RouteCollectionInterface | $routes | |
\CodeIgniter\HTTP\Request | $request | |
boolean | $getShared |
security(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\Security\Security
The Security class provides a few handy tools for keeping the site secure, most notably the CSRF protection tools.
\Config\App | $config | |
boolean | $getShared |
session(\Config\App $config = null, boolean $getShared = true) : \CodeIgniter\Session\Session
Return the session manager.
\Config\App | $config | |
boolean | $getShared |
throttler(boolean $getShared = true) : \CodeIgniter\Throttle\Throttler
The Throttler class provides a simple method for implementing rate limiting in your applications.
boolean | $getShared |
timer(boolean $getShared = true) : \CodeIgniter\Debug\Timer
The Timer class provides a simple way to Benchmark portions of your application.
boolean | $getShared |
toolbar(\Config\Toolbar $config = null, boolean $getShared = true) : \CodeIgniter\Debug\Toolbar
Return the debug toolbar.
\Config\Toolbar | $config | |
boolean | $getShared |
uri(string $uri = null, boolean $getShared = true) : \CodeIgniter\HTTP\URI
The URI class provides a way to model and manipulate URIs.
string | $uri | |
boolean | $getShared |
validation(\Config\Validation $config = null, boolean $getShared = true) : \CodeIgniter\Validation\Validation
The Validation class provides tools for validating input data.
\Config\Validation | $config | |
boolean | $getShared |
viewcell(boolean $getShared = true) : \CodeIgniter\View\Cell
View cells are intended to let you insert HTML into view that has been generated by any callable in the system.
boolean | $getShared |
typography(boolean $getShared = true) : \CodeIgniter\Typography\Typography
The Typography class provides a way to format text in semantically relevant ways.
boolean | $getShared |
discoverServices(string $name, array $arguments) : mixed
Will scan all psr4 namespaces registered with system to look for new Config\Services files. Caches a copy of each one, then looks for the service method in each, returning an instance of the service, if available.
string | $name | |
array | $arguments |