Skip to content

Latest commit

 

History

History
1674 lines (635 loc) · 14.1 KB

App.md

File metadata and controls

1674 lines (635 loc) · 14.1 KB

App

Properties

apps

protected static $apps
  • This property is static.

registry

protected array $registry

routes

protected array $routes

paths

protected array $paths

events

protected array $events

blocks

protected array $blocks

response

public ?\Lime\Response $response

request

public ?\Lime\Request $request

helpers

public \ArrayObject $helpers

layout

public mixed $layout

Methods

__construct

Constructor

public __construct(array $settings = []): mixed

Parameters:

Parameter Type Description
$settings array initial registry settings

__clone

Object behavior on clone

public __clone(): void

instance

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


service

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

stop application (exit)

public stop(mixed $data = null, ?int $status = null): void

Parameters:

Parameter Type Description
$data mixed
$status ?int

baseUrl

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


base

public base(string $path): void

Parameters:

Parameter Type Description
$path string

routeUrl

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


route

public route(): void

reroute

Redirect to path.

public reroute(string $path): void

Parameters:

Parameter Type Description
$path string Path redirect to.

set

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

retrieve

Get a value from the Lime registry

public retrieve(string $key, mixed $default = null): mixed

Parameters:

Parameter Type Description
$key string
$default mixed

path

Path helper method

public path(): mixed

paths

public paths( $namespace = null): array

Parameters:

Parameter Type Description
$namespace ****

pathToUrl

public pathToUrl( $path, bool $full = false): bool|string

Parameters:

Parameter Type Description
$path ****
$full bool

cache

Cache helper method

public cache(): mixed

on

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

Trigger event.

public trigger(string $event, array $params = []): bool

Parameters:

Parameter Type Description
$event string
$params array

render

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

Start block

public start(string $name): null

Parameters:

Parameter Type Description
$name string

end

End block

public end(string $name): null

Parameters:

Parameter Type Description
$name string

block

Get block content

public block(string $name, array $options = []): string

Parameters:

Parameter Type Description
$name string
$options array

escape

Escape string.

public escape(string $string, string $charset = null): string

Parameters:

Parameter Type Description
$string string
$charset string

style

Get style inc. markup

public style(mixed $href, ?string $version = null): string

Parameters:

Parameter Type Description
$href mixed
$version ?string

script

Get script inc. markup

public script(mixed $src, ?string $version = null): string

Parameters:

Parameter Type Description
$src mixed
$version ?string

assets

Get assets inc. markup

public assets(array|string $src, mixed $version = null): string

Parameters:

Parameter Type Description
$src array|string
$version mixed

get

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

post

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

bindClass

Bind Class to routes

public bindClass(string $class, ?string $alias = null): void

Parameters:

Parameter Type Description
$class string
$alias ?string

bindNamespace

Bind namespace to routes

public bindNamespace(string $namespace, ?string $alias = null): void

Parameters:

Parameter Type Description
$namespace string
$alias ?string

bind

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

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

Dispatch route

public dispatch(string $path): mixed

Parameters:

Parameter Type Description
$path string

render_route

Render dispatched route

protected render_route(string $route, array $params = []): string

Parameters:

Parameter Type Description
$route string
$params array

invoke

Invoke Class as controller

public invoke(string $class, string $action = 'index', array $params = []): mixed

Parameters:

Parameter Type Description
$class string
$action string
$params array

param

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

req_is

Request helper function

public req_is(string $type): bool

Parameters:

Parameter Type Description
$type string

getClientIp

Get client ip.

public getClientIp(): string

getClientLang

Get client language

public getClientLang(string $default = "en"): string

Parameters:

Parameter Type Description
$default string

getSiteUrl

Get site url

public getSiteUrl(bool $withpath = false): string

Parameters:

Parameter Type Description
$withpath bool

hash

Create Hash

public hash(string $text, mixed $algo = PASSWORD_BCRYPT): string

Parameters:

Parameter Type Description
$text string
$algo mixed

encode

RC4 encryption

public encode(string $data, string $pwd, bool $base64encoded = false): string

Parameters:

Parameter Type Description
$data string
$pwd string
$base64encoded bool

decode

Decode RC4 encrypted text

public decode(string $data, string $pwd): string

Parameters:

Parameter Type Description
$data string
$pwd string

helper

public helper(string $helper): \Lime\Helper

Parameters:

Parameter Type Description
$helper string

isAbsolutePath

public isAbsolutePath(string $path): bool

Parameters:

Parameter Type Description
$path string

module

public module(string $name): mixed

Parameters:

Parameter Type Description
$name string

registerModule

public registerModule(string $name, string $dir): \Lime\Module

Parameters:

Parameter Type Description
$name string
$dir string

loadModule

public loadModule(mixed $path, mixed $prefix = null): mixed

Parameters:

Parameter Type Description
$path mixed
$prefix mixed

loadModules

public loadModules(mixed $dirs, bool $autoload = true, mixed $prefix = null): array

Parameters:

Parameter Type Description
$dirs mixed
$autoload bool
$prefix mixed

bootModule

protected bootModule(\Lime\Module $module): void

Parameters:

Parameter Type Description
$module \Lime\Module

__get

public __get(mixed $name): mixed

Parameters:

Parameter Type Description
$name mixed

offsetSet

public offsetSet(mixed $key, mixed $value): void

Parameters:

Parameter Type Description
$key mixed
$value mixed

offsetGet

public offsetGet(mixed $key): mixed

Parameters:

Parameter Type Description
$key mixed

offsetExists

public offsetExists(mixed $key): bool

Parameters:

Parameter Type Description
$key mixed

offsetUnset

public offsetUnset(mixed $key): void

Parameters:

Parameter Type Description
$key mixed

__invoke

public __invoke(mixed $helper): mixed

Parameters:

Parameter Type Description
$helper mixed

getRequestfromGlobals

protected getRequestfromGlobals(): \Lime\Request