Pionia Core

Pionia

Table of Contents

Packages

Pionia
Http
Middlewares

Interfaces

ApplicationContract
AuthenticationChainContract
AuthenticationContract
Authentication contract.
BaseSwitchContract
CommandContract
CorsContract
IsolatableContract
KernelContract
MiddlewareContract
NewLineAware
ServiceContract
DatabaseDriverInterface
TemplateEngineInterface
CarbonDoctrineType
CarbonConverterInterface
CarbonInterface
Common interface for Carbon and CarbonImmutable.
BadMethodCallException
Exception
InvalidArgumentException
RuntimeException
TranslatorStrongTypeInterface
Mark translator using strong type from symfony/translation >= 6.

Classes

AuthenticationBackend
Base class for other Authentication backend to inherit.
AuthenticationChain
Authentication chain.
ContextUserObject
This is the context object holding the current session
PostAuthRunEvent
Event fired after the authentication chain has been run
PreAuthRunEvent
Event fired before the authentication chain has been run
Sessions
This class is responsible for handling all session related operations
EnvResolver
PioniaApplication
CacheDeleteCommand
ClearCacheCommand
PruneCacheCommand
ListAliasCommand
BuildFrontendCommand
Builds and hosts the frontend in our app server for production
CleanBuildCommand
Cleans all build files that were formerly added via building.
DropFrontendCommand
Drops an entire frontend
ScaffoldFrontendCommand
Scaffolds any frontend project in the right directory using a package manage of choice and a frontend framework of choice.
CreateMiddleware
For Creating a new middleware in the middlewares directory by running `pionia gen:middleware {name}`
GenerateAuthenticationBackend
For Creating a new authentication backend in the authenticationBackends directory by running `pionia gen:auth {name}`
GenerateCommand
This command is used to generate a new custom command.
GenerateService
For Creating a new service in the services directory by running `pionia gen:service {name}`
GenerateSwitch
Creates a new Pionia Switch in Switches directory by running `pionia gen:switch {version}`
StartServer
For starting the command line server. This should be good choice only in development
PioniaCache
Pionia caching port of the Psr16Cache class provided by Symfony.
PioniaCacheAdaptor
Arrayable
Carbon
A simple API extension for DateTime.
HighOrderTapProxy
HighOrderWhenProxy
BaseCommand
OutputStyle
Parser
PioniaCors
Event
PioniaEventDispatcher
BaseException
This is the base exception class that all other exceptions must extend.
CommandException
This exception is thrown when a cli command fails.
ControllerException
This exception is thrown controller parsing fails in anyway
DatabaseException
This exception is thrown when an error occurs during database connection establishment.
FailedRequiredException
This exception is thrown when a required field is not provided in the request
InvalidDataException
This exception is thrown when a regular expression fails and we are in the exceptions mode.
LimitPaginationException
This exception is thrown when a limit is provided in a paginated query using the Pagination class
OffsetPaginationException
This exception is thrown when an offset is passed in a paginated query using the Pagination class
ResourceNotFoundException
This exception is thrown when a service requested is not found.
RestParseException
This exception is thrown when an error occurs during REST parsing.
RestPHPException
This exception is thrown when an error occurs during REST parsing.
UserUnauthenticatedException
This exception is thrown when one tries to access a protected resource without being authenticated
UserUnauthorizedException
This exception is thrown when a user is not authorized to access a resource
PostSwitchRunEvent
Event runs after the switch runs, you can access the response from this event
PreKernelBootEvent
Event fired before the kernel boots
WebKernel
Request
This method extends the Symfony request class to add more functionality to the request object.
BaseResponse
This provides a uniform response format for our entire application.
Response
This is the internal response. It should not be used anywhere in the project but in the core framework
BaseRoutes
This is the base routes class, it extends the Symfony route collection class and is used to define routes in the framework
PioniaRouter
This is the basis for defining routes in the application.
SupportedHttpMethods
This class holds the supported http methods in the framework.
RetrieveCreateUpdateService
Adds retrieve, create and update actions to the service.
RetrieveListCreateService
Adds the retrieve and create actions to the service.
RetrieveListCreateUpdateDeleteService
Adds the retrieve, create and update actions to the service.
RetrieveListDeleteService
Adds the delete and retrieve actions to the service.
RetrieveListRandomService
Adds the retrieve and create actions to the service.
RetrieveListUpdateDeleteService
Adds the retrieve, update and delete actions to the service.
RetrieveListUpdateService
Adds the retrieve and update actions to the service.
UniversalGenericService
Adds the retrieve/details, create, list, update, random and delete actions to the service.
GenericService
Base Service for generic services
Service
Base Service for generic services
BaseApiServiceSwitch
This is the base class for the API service switch. It is used to switch between different services based on the request data.
PioniaLogger
Middleware
MiddlewareChain
ContractBuilder
Piql
Pionia Query Builder Provides base-strategy to perform all database queries in all RDBMS
Porm
Raw
The Medoo raw object.
Agg
Aggregate functions for the PORM library.
Builder
Join
Builds relationships across multiple tables.
Where
Db
Provides a basis for other query builders to base on.
Connection
BaseDatabaseException
This is the base exception class that all other exceptions must extend.
InvalidWhereClause
This is the base exception class that all other exceptions must extend.
PaginationCore
TemplateEngine
AuthenticationBackendMock
Base class for other Authentication backend to inherit.
MiddlewareMock
MiddlewareMock2
PioniaTestCase
Support
Validator
This class is used to validate data
CarbonImmutableType
CarbonType
DateTimeDefaultPrecision
DateTimeImmutableType
DateTimeType
LazyMessageFormatter
LazyMessageFormatter
DatePeriodBase
LazyTranslator
LazyTranslator
DatePeriodBase
AbstractTranslator
Callback
Carbon
A simple API extension for DateTime.
CarbonImmutable
A simple API extension for DateTimeImmutable.
CarbonInterval
A simple API extension for DateInterval.
CarbonPeriod
Substitution of DatePeriod with some modifications and many more features.
CarbonPeriodImmutable
Substitution of DatePeriod with some modifications and many more features.
CarbonTimeZone
Invoker
BadComparisonUnitException
BadFluentConstructorException
BadFluentSetterException
EndLessPeriodException
ImmutableException
InvalidCastException
InvalidDateException
InvalidFormatException
InvalidIntervalException
InvalidPeriodDateException
InvalidPeriodParameterException
InvalidTimeZoneException
InvalidTypeException
NotACarbonClassException
NotAPeriodException
NotLocaleAwareException
OutOfRangeException
ParseErrorException
UnitException
UnitNotConfiguredException
UnknownGetterException
UnknownMethodException
UnknownSetterException
UnknownUnitException
UnreachableException
UnsupportedUnitException
Factory
A factory to generate Carbon instances with common settings.
FactoryImmutable
A factory to generate CarbonImmutable instances with common settings.
Language
ServiceProvider
MessageFormatterMapper
MacroExtension
Class MacroExtension.
MacroMethodReflection
Translator
TranslatorImmutable
WrapperClock

Traits

BuiltInServices
Cacheable
Add caching capabilities to any class.
CallsCommands
HasParameters
InteractsWithIO
AuthTrait
This trait provides common authentication methods for the services
CrudContract
EventsContract
JoinContract
UploadsContract
CreateMixin
This mixin adds the create functionality to the service.
DeleteMixin
This mixin adds the delete functionality to the service.
ListMixin
This mixin adds the list functionality to the service.
RandomMixin
This mixin adds the random functionality to the service.
RetrieveMixin
This mixin adds the retrieve method to the class that uses it.
UpdateMixin
This mixin adds the update functionality to the service.
RequestActionTrait
Provides helper methods for request actions
MiddlewareTrait
AggregateTrait
FilterTrait
JoinParseTrait
ParseTrait
TableLevelQueryTrait
HelperMocksTrait
AppDatabaseHelper
AppHelpersTrait
ApplicationLifecycleHooks
CachedEndpoints
Checks and returns cached moonlight endpoints.
Conditionable
Containable
Dumpable
InteractsWithTime
Microable
PathsTrait
ValidationTrait
CarbonTypeConverter
Boundaries
Trait Boundaries.
Cast
Trait Cast.
Comparison
Trait Comparison.
Converter
Trait Converter.
Creator
Trait Creator.
Date
A simple API extension for DateTime.
DeprecatedPeriodProperties
Difference
Trait Difference.
IntervalRounding
Trait to call rounding methods to interval or the interval of a period.
IntervalStep
LocalFactory
Remember the factory that was the current at the creation of the object.
Localization
Trait Localization.
Macro
Trait Macros.
MagicParameter
Trait MagicParameter.
Mixin
Trait Mixin.
Modifiers
Trait Modifiers.
Mutability
Trait Mutability.
ObjectInitialisation
Options
Trait Options.
Rounding
Trait Rounding.
Serialization
Trait Serialization.
StaticLocalization
Static config for localization.
StaticOptions
Options related to a static variable.
Test
Timestamp
Trait Timestamp.
ToStringFormat
Trait ToStringFormat.
Units
Trait Units.
Week
Trait Week.

Enums

NAMESPACES
DIRECTORIES
JoinType
Supported join types in Pionia
PioniaApplicationType
Month
Unit
WeekDay

Constants

BASEPATH  = $applicationPath
BASEPATH  = dirname(__DIR__, 2)
PIONIA_BINARY  = 'pionia'

Functions

allBuiltins()  : Arrayable
tap()  : HighOrderTapProxy|TValue
Call the given Closure with the given value then return the value.
arr()  : Arrayable
Get an item from an array using "dot" notation.
env()  : mixed
Get an item from the environment. Or default if it does not exist.
setEnv()  : void
Adds a temporary key-value to the environment.
response()  : BaseResponse
Helper function to return a response
app()  : PioniaApplication
Helper function to return the application instance
container()  : Container
Helper function to return the application container
db()  : Porm|null
Run any pionia-powered queries
table()  : Porm
Run any pionia-powered queries
alias()  : mixed
directoryFor()  : mixed
Get any directory from the application container
yesNo()  : string
This function returns a yes or no phrase based on the condition
asBool()  : array<string|int, mixed>
convert a value to a boolean
writeIniFile()  : bool
Write an ini configuration file This writes to the file in a lock-safe manner
logger()  : LoggerInterface
Get the logger instance from the application container
addIniSection()  : bool
This function adds a new section to an ini file We generally use this to generate and add new sections to the generated.ini file which holds settings for the auto-generated files
cachedResponse()  : BaseResponse
This function caches a response if the service has caching enabled.
recached()  : BaseResponse
Acronym for `cachedResponse` function but with more readable arguments
render()  : void
Render a template file from the templates folder.
parseHtml()  : array<string|int, mixed>
Get all the builtins
asset()  : string|null
Get the asset path
blank()  : bool
Determine if the given value is "blank".
validate()  : Validator
Validate data
toCamelCase()  : string
Convert a string to camel case
toSnakeCase()  : string
Convert a string to snake case
classify()  : string
Convert a string to a class name like format
arrayToString()  : string
Convert an array to a string
slugify()  : string
Convert a string to a slug-like format
singularize()  : string
Convert a string to a singular form
pluralize()  : string
Convert a string to a plural form
capitalize()  : string
Capitalize a string
jsonify()  : string
Convert anything to a json string
flatten()  : array<string|int, mixed>
Flatten an array
getMaxHistoryMonthsByAmount()  : int
getHtmlAttribute()  : string
getOpenCollectiveSponsors()  : string

Constants

BASEPATH

public mixed BASEPATH = dirname(__DIR__, 2)

Functions

tap()

Call the given Closure with the given value then return the value.

tap(TValue $value[, callable(TValue): mixed|null $callback = null ]) : HighOrderTapProxy|TValue

Value returned is not transformed by the closure.

Parameters
$value : TValue
$callback : callable(TValue): mixed|null = null
Tags
template

TValue

Return values
HighOrderTapProxy|TValue

arr()

Get an item from an array using "dot" notation.

arr(array<string|int, mixed>|null $array) : Arrayable
Parameters
$array : array<string|int, mixed>|null
Return values
Arrayable

env()

Get an item from the environment. Or default if it does not exist.

env([string|null $key = null ][, mixed $default = null ]) : mixed

If both the key and the default value are null, the function should return the entire environment.

Parameters
$key : string|null = null
$default : mixed = null

setEnv()

Adds a temporary key-value to the environment.

setEnv(string $key, mixed $value) : void

This can only be retrieved using the env function.

Parameters
$key : string
$value : mixed

response()

Helper function to return a response

response([ $returnCode = 0 ][, string|null $returnMessage = null ][, mixed $returnData = null ][, mixed $extraData = null ]) : BaseResponse
Parameters
$returnCode : = 0

int

$returnMessage : string|null = null
$returnData : mixed = null
$extraData : mixed = null
Return values
BaseResponse

container()

Helper function to return the application container

container() : Container
Return values
Container

db()

Run any pionia-powered queries

db(string $tableName[, string|null $tableAlias = null ][, string|null $using = null ]) : Porm|null
Parameters
$tableName : string

The name of the table to connect to

$tableAlias : string|null = null
$using : string|null = null
Tags
throws
Exception
Return values
Porm|null

table()

Run any pionia-powered queries

table(string $tableName[, string|null $tableAlias = null ][, string|null $using = null ]) : Porm
Parameters
$tableName : string

The name of the table to connect to

$tableAlias : string|null = null

The alias to use for the table provided

$using : string|null = null

The connection to use

Tags
throws
Exception
example
table('users')->where(['username' => 'Pionia'])->get();
Return values
Porm

The porm instance for further chaining of queries

alias()

alias(mixed $key) : mixed
Parameters
$key : mixed

directoryFor()

Get any directory from the application container

directoryFor(mixed $key) : mixed
Parameters
$key : mixed

yesNo()

This function returns a yes or no phrase based on the condition

yesNo(bool $condition[, string|null $yesPhrase = 'Yes' ][, string|null $noPhrase = 'No' ]) : string
Parameters
$condition : bool

The condition to check

$yesPhrase : string|null = 'Yes'

The phrase to return if the condition is true

$noPhrase : string|null = 'No'

The phrase to return if the condition is false

Return values
string

asBool()

convert a value to a boolean

asBool(mixed $value) : array<string|int, mixed>
Parameters
$value : mixed
Return values
array<string|int, mixed>

writeIniFile()

Write an ini configuration file This writes to the file in a lock-safe manner

writeIniFile(string $file[, array<string|int, mixed> $array = [] ]) : bool
Parameters
$file : string
$array : array<string|int, mixed> = []
Return values
bool

logger()

Get the logger instance from the application container

logger() : LoggerInterface
Return values
LoggerInterface

addIniSection()

This function adds a new section to an ini file We generally use this to generate and add new sections to the generated.ini file which holds settings for the auto-generated files

addIniSection(string $section[, array<string|int, mixed>|null $keyValueToAppend = [] ][, string $iniFile = 'generated.ini' ]) : bool

This function will create the file if it does not exist, add the section if it does not exist or update the section if it exists

Parameters
$section : string
$keyValueToAppend : array<string|int, mixed>|null = []
$iniFile : string = 'generated.ini'
Return values
bool

cachedResponse()

This function caches a response if the service has caching enabled.

cachedResponse(Service $instance, BaseResponse $response[, mixed $ttl = 60 ]) : BaseResponse

Cached key is of the format service_action in camel case. If no ttl is defined, caching will happen for only 60 seconds

Parameters
$instance : Service

The service we are currently in, just pass this here!

$response : BaseResponse

The response object to cache, you can use response() for this!

$ttl : mixed = 60

The time to live for the cache, defaults to 60 seconds

Tags
note

This function is only available if the service has caching enabled

note

This is still under rigorous tests

Return values
BaseResponse

The cached response / the response you passed. It's not tampered with

recached()

Acronym for `cachedResponse` function but with more readable arguments

recached(Service $instance, mixed ...$args) : BaseResponse
Parameters
$instance : Service

The service we are currently in, just pass this here

$args : mixed

The arguments to pass to the cachedResponse function

Tags
note

This function is only useful if the service has caching enabled

Return values
BaseResponse

render()

Render a template file from the templates folder.

render( $file[, array<string|int, mixed>|null $data = [] ]) : void
Parameters
$file :
$data : array<string|int, mixed>|null = []

parseHtml()

Get all the builtins

parseHtml( $file[, array<string|int, mixed>|null $data = [] ]) : array<string|int, mixed>
Parameters
$file :
$data : array<string|int, mixed>|null = []
Return values
array<string|int, mixed>

asset()

Get the asset path

asset( $file[, string|null $dir = null ]) : string|null
Parameters
$file :
$dir : string|null = null
Return values
string|null

blank()

Determine if the given value is "blank".

blank(mixed $value) : bool
Parameters
$value : mixed
Tags
phpstan-assert-if-false

!=null|'' $value

phpstan-assert-if-true

!=numeric|bool $value

Return values
bool

validate()

Validate data

validate(string $field, Arrayable|Request|Service $data) : Validator
Parameters
$field : string
$data : Arrayable|Request|Service
Return values
Validator

toCamelCase()

Convert a string to camel case

toCamelCase(string $value) : string
Parameters
$value : string
Return values
string

toSnakeCase()

Convert a string to snake case

toSnakeCase(string $value) : string
Parameters
$value : string
Return values
string

classify()

Convert a string to a class name like format

classify(string $value) : string
Parameters
$value : string
Return values
string

arrayToString()

Convert an array to a string

arrayToString(array<string|int, mixed> $value[, string|null $separator = ',' ]) : string
Parameters
$value : array<string|int, mixed>
$separator : string|null = ','
Return values
string

slugify()

Convert a string to a slug-like format

slugify(string $value) : string
Parameters
$value : string
Return values
string

singularize()

Convert a string to a singular form

singularize(string $word) : string
Parameters
$word : string
Return values
string

pluralize()

Convert a string to a plural form

pluralize(string $word) : string
Parameters
$word : string
Return values
string

capitalize()

Capitalize a string

capitalize(string $phrase) : string
Parameters
$phrase : string
Return values
string

jsonify()

Convert anything to a json string

jsonify(mixed $phrase) : string
Parameters
$phrase : mixed
Return values
string

flatten()

Flatten an array

flatten(array<string|int, mixed> $flatten) : array<string|int, mixed>
Parameters
$flatten : array<string|int, mixed>
Tags
example

flatten(['a', 'b', ['c', 'd']]) => ['a', 'b', 'c', 'd']

Return values
array<string|int, mixed>

getMaxHistoryMonthsByAmount()

getMaxHistoryMonthsByAmount(mixed $amount) : int
Parameters
$amount : mixed
Return values
int

getHtmlAttribute()

getHtmlAttribute(mixed $rawValue) : string
Parameters
$rawValue : mixed
Return values
string

getOpenCollectiveSponsors()

getOpenCollectiveSponsors() : string
Return values
string

        
On this page

Search results