BaseController
    
            
            in package
            
        
    
    
    
BasedController class.
Tags
Attributes
- #[AllowDynamicProperties]
 
Table of Contents
Properties
- $Container : Container
 - $Db : Db
 - $httpAcceptContentTypes : array<string|int, mixed>
 - $Modules : Modules
 - $Views : Views
 
Methods
- __construct() : mixed
 - Based controller.
 - determineAcceptContentType() : string
 - Determine HTTP accept content-type.
 - responseAcceptType() : string
 - Response the `$output` content by `accept` type in request header.
 - responseJson() : string
 - Set application/json header and return json encoded.
 - responseNoCache() : mixed
 - Send no cache headers.
 - responseXml() : string
 - Set application/xml header and return XML converted from array.
 
Properties
$Container
    protected
        Container
    $Container
    
    
    
    
    
$Db
    protected
        Db
    $Db
    
    
    
    
    
$httpAcceptContentTypes
    protected
        array<string|int, mixed>
    $httpAcceptContentTypes
    
    
        The HTTP accept content types. Sorted by quality values. This property can access after called responseAcceptType() method.
Tags
$Modules
    protected
        Modules
    $Modules
    
    
    
    
    
$Views
    protected
        Views
    $Views
    
    
    
    
    
Methods
__construct()
Based controller.
    public
                    __construct(Container $Container) : mixed
    Parameters
- $Container : Container
 - 
                    
The DI container class.
 
determineAcceptContentType()
Determine HTTP accept content-type.
    protected
                    determineAcceptContentType() : string
    since v1.1.3 Use this method from Input class instead.
Tags
Return values
string —Return determined content type.
responseAcceptType()
Response the `$output` content by `accept` type in request header.
    protected
                    responseAcceptType(mixed $output) : string
    This method can detect accept in request header and response to certain content type automatically.
Parameters
- $output : mixed
 - 
                    
The content will be response. If this is array and
acceptis JSON or XML then it will automatically converted. 
Return values
string —Return content type header and $output body.
responseJson()
Set application/json header and return json encoded.
    protected
                    responseJson(mixed $output) : string
    Parameters
- $output : mixed
 - 
                    
The content will be json encode.
 
Return values
string —Return json encoded string.
responseNoCache()
Send no cache headers.
    protected
                    responseNoCache() : mixed
    This should be called before response body. It is very useful with redirect to prevent redirect cached.
responseXml()
Set application/xml header and return XML converted from array.
    protected
                    responseXml(mixed $output) : string
    Parameters
- $output : mixed
 - 
                    
The content will be XML. Recommended type is array.
 
Return values
string —Return XML converted content from $output array.