- Full name:
\Lime\App
- This class implements:
\ArrayAccess
protected static $apps
- This property is static.
protected array $registry
protected array $routes
protected array $paths
protected array $events
protected array $blocks
public ?\Lime\Response $response
public ?\Lime\Request $request
public \ArrayObject $helpers
public mixed $layout
Constructor
public __construct(array $settings = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$settings |
array | initial registry settings |
Object behavior on clone
public __clone(): void
Get App instance
public static instance(string $name, bool $clone = false): object
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Lime app name |
$clone |
bool |
Return Value:
Lime app object
Returns a closure that stores the result of the given closure
public service(string $name, \Closure $callable): object
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | |
$callable |
\Closure |
stop application (exit)
public stop(mixed $data = null, ?int $status = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
mixed | |
$status |
?int |
Returns link based on the base url of the app
public baseUrl(string $path): string
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | e.g. /js/myscript.js |
Return Value:
Link
public base(string $path): void
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string |
Returns link based on the route url of the app
public routeUrl(string $path): string
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | e.g. /pages/home |
Return Value:
Link
public route(): void
Redirect to path.
public reroute(string $path): void
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | Path redirect to. |
Put a value in the Lime registry
public set(string $key, mixed $value): self
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string | Key name |
$value |
mixed | Value |
Get a value from the Lime registry
public retrieve(string $key, mixed $default = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string | |
$default |
mixed |
Path helper method
public path(): mixed
public paths( $namespace = null): array
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace |
**** |
public pathToUrl( $path, bool $full = false): bool|string
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
**** | |
$full |
bool |
Cache helper method
public cache(): mixed
Bind an event to closure
public on(string $event, \Closure $callback, int $priority): \Lime\App
Parameters:
Parameter | Type | Description |
---|---|---|
$event |
string | |
$callback |
\Closure | |
$priority |
int |
Trigger event.
public trigger(string $event, array $params = []): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$event |
string | |
$params |
array |
Render view.
public render(string $____template, array $_____slots = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$____template |
string | Path to view |
$_____slots |
array | Passed variables |
Return Value:
Rendered view
Start block
public start(string $name): null
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string |
End block
public end(string $name): null
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string |
Get block content
public block(string $name, array $options = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | |
$options |
array |
Escape string.
public escape(string $string, string $charset = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | |
$charset |
string |
Get style inc. markup
public style(mixed $href, ?string $version = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$href |
mixed | |
$version |
?string |
Get script inc. markup
public script(mixed $src, ?string $version = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$src |
mixed | |
$version |
?string |
Get assets inc. markup
public assets(array|string $src, mixed $version = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$src |
array|string | |
$version |
mixed |
Bind GET request to route
public get(string $path, \Closure $callback, bool $condition = true): void
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | |
$callback |
\Closure | |
$condition |
bool |
Bind POST request to route
public post(string $path, \Closure $callback, bool $condition = true): void
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | |
$callback |
\Closure | |
$condition |
bool |
Bind Class to routes
public bindClass(string $class, ?string $alias = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
string | |
$alias |
?string |
Bind namespace to routes
public bindNamespace(string $namespace, ?string $alias = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace |
string | |
$alias |
?string |
Bind request to route
public bind(string $path, \Closure $callback, bool $condition = true): void
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string | |
$callback |
\Closure | |
$condition |
bool |
Run Application request
public run(string $route = null, ?\Lime\Request $request = null, bool $flush = true): void
Parameters:
Parameter | Type | Description |
---|---|---|
$route |
string | Route to parse |
$request |
?\Lime\Request | |
$flush |
bool |
Dispatch route
public dispatch(string $path): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string |
Render dispatched route
protected render_route(string $route, array $params = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$route |
string | |
$params |
array |
Invoke Class as controller
public invoke(string $class, string $action = 'index', array $params = []): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
string | |
$action |
string | |
$params |
array |
Get request variables
public param(string $index = null, mixed $default = null, array $source = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$index |
string | |
$default |
mixed | |
$source |
array |
Request helper function
public req_is(string $type): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$type |
string |
Get client ip.
public getClientIp(): string
Get client language
public getClientLang(string $default = "en"): string
Parameters:
Parameter | Type | Description |
---|---|---|
$default |
string |
Get site url
public getSiteUrl(bool $withpath = false): string
Parameters:
Parameter | Type | Description |
---|---|---|
$withpath |
bool |
Create Hash
public hash(string $text, mixed $algo = PASSWORD_BCRYPT): string
Parameters:
Parameter | Type | Description |
---|---|---|
$text |
string | |
$algo |
mixed |
RC4 encryption
public encode(string $data, string $pwd, bool $base64encoded = false): string
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
string | |
$pwd |
string | |
$base64encoded |
bool |
Decode RC4 encrypted text
public decode(string $data, string $pwd): string
Parameters:
Parameter | Type | Description |
---|---|---|
$data |
string | |
$pwd |
string |
public helper(string $helper): \Lime\Helper
Parameters:
Parameter | Type | Description |
---|---|---|
$helper |
string |
public isAbsolutePath(string $path): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
string |
public module(string $name): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string |
public registerModule(string $name, string $dir): \Lime\Module
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | |
$dir |
string |
public loadModule(mixed $path, mixed $prefix = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$path |
mixed | |
$prefix |
mixed |
public loadModules(mixed $dirs, bool $autoload = true, mixed $prefix = null): array
Parameters:
Parameter | Type | Description |
---|---|---|
$dirs |
mixed | |
$autoload |
bool | |
$prefix |
mixed |
protected bootModule(\Lime\Module $module): void
Parameters:
Parameter | Type | Description |
---|---|---|
$module |
\Lime\Module |
public __get(mixed $name): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
mixed |
public offsetSet(mixed $key, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed | |
$value |
mixed |
public offsetGet(mixed $key): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
public offsetExists(mixed $key): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
public offsetUnset(mixed $key): void
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
mixed |
public __invoke(mixed $helper): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$helper |
mixed |
protected getRequestfromGlobals(): \Lime\Request