Neuron-PHP

Application

Table of Contents

Interfaces

IApplication
Interface IApplication
StreamInterface
Interface for input/output stream abstraction.
IClock
Interface for time/clock operations abstraction.
IFileSystem
Interface for file system operations abstraction.
IHttpClient
Interface for HTTP client operations abstraction.
IHttpResponse
Interface for HTTP response abstraction.
IRandom
Interface for random generation abstraction.
ISession
Interface for session management abstraction.
IFilter
Interface for sanitizing external PHP variables.
IParser
Generic parsing capabilities.
ISettingSource
Access to setting based services.
ICompound
Interface for compound data types
IMapper
IBroadcaster
Register listeners and broadcast events to them.
IListener
Generic listener interface.
ILogger
Logger interface.
ICacheStorage
IRunnable
Interface to add runnable behavior to an object.
IObserver
Interface to allow an observable object to notify an observer.
ISingleton
Singleton pattern.
ITemplateEngine
Template engine for loading and rendering stub files
ITimer
Stopwatch capabilities.
IWebHook
webhook interface
ICollection
Validation collection.

Classes

Base
Base functionality for applications.
CommandLineBase
Base functionality for command line applications.
Event
Event Singleton to manage events as a cross-cutting concern.
EventLoader
Loads and registers event listeners from the config/event-listeners.yaml file.
EventEmitter
Facade to simplify the registration of events and listeners and the emitting of events.
InitializerRunner
Loads and executes all initializers in the app/Initializers directory.
Command
Abstract base class for all CLI commands.
ComponentListCommand
Lists all available commands organized by component
ConfigEnvCommand
Export configuration as environment-style pairs for production setups.
HelpCommand
Help command - displays help for a specific command
VersionCommand
Version command - displays version information for Neuron components
Registry
Registry for managing CLI commands.
Input
Handles input parsing and retrieval for CLI commands.
Output
Handles output formatting and display for CLI commands.
ProgressBar
Progress bar for displaying task progress in the CLI.
StandardStream
Standard stream implementation using real STDIN/STDOUT.
TestStream
Test stream implementation for unit testing.
ComponentLoader
Loads commands from installed Neuron components.
InstallCommand
Install the CMS admin UI into the project
UpgradeCommand
Upgrade the CMS to the latest version
DisableCommand
CLI command for disabling maintenance mode.
EnableCommand
CLI command for enabling maintenance mode.
StatusCommand
CLI command for checking maintenance mode status.
CreateCommand
Create a new user
DeleteCommand
Delete a user
ListCommand
List all users
Provider
CLI provider for the CMS component.
Blog
Base content controller for the Neuron CMS framework.
MaintenanceConfig
Configuration handler for maintenance mode.
MaintenanceFilter
Route filter that intercepts requests during maintenance mode.
MaintenanceManager
Manages maintenance mode state and operations.
BadRequestMethod
Thrown when a bad request method is used when adding a new route.
Base
Neuron base class for building exceptions.
MapNotFound
Thrown when a requested/specified resource is not found.
MissingMethod
Thrown by the instantiator function when the specified method is missing from the target controller.
NotFound
Thrown when a requested/specified resource is not found.
PropertyNotFound
Thrown when a requested/specified resource is not found.
Error
A PHP implementation of the error.h c header.
FakeRandom
Fake random implementation for testing.
FrozenClock
Frozen clock implementation for testing.
HttpResponse
HTTP response implementation.
MemoryFileSystem
In-memory file system implementation for testing.
MemoryHttpClient
In-memory HTTP client implementation for testing.
MemorySession
In-memory session implementation for testing.
RealClock
Real clock implementation using PHP native time functions.
RealFileSystem
Real file system implementation.
RealHttpClient
Real HTTP client implementation using curl.
RealRandom
Real random implementation using PHP cryptographically secure functions.
RealSession
Real session implementation using PHP native session functions.
Date
General date functions.
Version
Cookie
Filters cookies.
Get
Filters get data.
Post
Filters post data
Server
Filters SERVER data.
Session
Filters session data.
DateRange
Object for holding date ranges.
GpsPoint
Object for holding lot/lon data.
NumericRange
Object for holding numeric ranges.
Version
Object for loading/parsing version information.
CSV
Parses a line of CSV data to an associative array.
FirstMI
Parses first name middle initial.
LastFirstMI
Parses last, first m
Positional
Env
environment variable based settings.
Ini
Memory
Internal array based setting source.
Yaml
UnitConversion
Unit conversion functions.
Collection
Base class for compound DTOs.
Base
Base class for compound DTOs.
Dto
DTO Class handles compound objects with named properties.
Dynamic
Factory
Generic
Property
Validation
Neuron base class for building exceptions.
Base
Base class for broadcasters
Generic
Generic broadcaster that dispatches events inline.
Log
Broadcaster that writes all dispatched events to a log file.
Currency
Formats currency as html.
Date
Formats dates
DateBase
Base class for date based formatting.
DateTime
Formats Date/Time
PhoneNumber
Formats phone numbers.
Time
Formats time.
FailedCommand
CLI command for listing failed jobs.
FlushCommand
CLI command for flushing queue or failed jobs.
ForgetCommand
CLI command for deleting failed jobs.
RetryCommand
CLI command for retrying failed jobs.
RunCommand
CLI command for running both the scheduler and queue worker together.
ScheduleCommand
CLI command for running the job scheduler.
StatsCommand
CLI command for showing queue statistics.
WorkCommand
CLI command for running the queue worker.
Provider
CLI provider for the Jobs component.
Data
DTO to pass log information internally.
DevNull
Generates no output. Use as dev/null.
Echoer
Outputs log data using the php echo command. (non stdout)
Email
Sends individual log data via email.
File
Appends log data to a file.
Memory
Appends log data to a string.
Nightwatch
Sends log data to Laravel Nightwatch monitoring service.
Papertrail
Outputs log data to Papertrail via remote syslog protocol.
Slack
Outputs log data to a Slack channel.
Socket
Outputs log data to a socket.
StdErr
Outputs log data to STDERR.
StdOut
Outputs log data to STDOUT.
StdOutStdErr
Outputs debug, info, notice, and warning to STDOUT.
SysLog
Outputs log data to syslog.
WebHookPost
Sends individual log data to a webhook.
WebSocket
Outputs log data to a WebSocket connection.
FilterBase
RunLevel
Standard filter that excludes log data based on the data level vs run level.
Base
CSV
Formats log data into a CSV format.
HTML
Formats log data as html.
HTMLEmail
Formats log data as an html email.
JSON
Formats log data as JSON.
Nightwatch
Formats log data for Laravel Nightwatch API.
PlainText
Formats log data as plain text.
Raw
Raw log format. Only includes the text. No date/time or level.
Slack
Formats log data for Slack.
Log
Singleton for cross-cutting log access.
Logger
Single Logger implementation.
LogMux
Log multiplexer. Allows writing to multiple logs simultaneously.
Application
Class Application
CacheConfig
CacheException
CacheStorageFactory
Factory class for creating cache storage instances based on configuration
FileCacheStorage
RedisCacheStorage
ViewCache
ClearCommand
CLI command for clearing the MVC view cache.
StatsCommand
CLI command for displaying MVC cache statistics.
DumpCommand
CLI command for exporting database data in various formats Supports SQL, JSON, CSV, and YAML output formats
RestoreCommand
CLI command for restoring database data from various formats Supports SQL, JSON, CSV, and YAML input formats
CreateCommand
CLI command for creating a new database migration
RollbackCommand
CLI command for rolling back database migrations
RunCommand
CLI command for running database migrations
SeedCommand
CLI command for running database seeders
StatusCommand
CLI command for showing migration status
ListCommand
CLI command for listing MVC routes.
DumpCommand
CLI command for exporting database schema to YAML Similar to Rails' rake db:schema:dump
Provider
CLI provider for the MVC component.
Base
Factory
Used to instantiate a new controller object.
HttpCodes
DataExporter
Exports database data in various formats Supports SQL, JSON, CSV, and YAML output formats
DataExporterWithORM
Database data exporter using ORM QueryBuilder for SQL injection protection
DataImporter
Imports database data from various formats Supports SQL, JSON, CSV, and YAML input formats
MigrationManager
Manages database migrations using Phinx Bridges Neuron configuration to Phinx
SchemaExporter
Exports database schema to YAML format for reference purposes Similar to Rails' schema.rb functionality
SqlWhereValidator
SQL WHERE clause validator to prevent SQL injection attacks
Http404
Event generated when a 404 takes place.
Http500
Event generated when a 500 error takes place.
Request
Class Request
Html
Generate html output by combining a layout with a view and data.
Markdown
Generate html output by combining a layout with a view and data.
Cache
Maps strings to command classes.
Factory
Gets or creates a command object.
AndCriteria
Abstract base class for implementing the Criteria pattern.
KeyValue
Abstract base class for implementing the Criteria pattern.
LogicBase
Abstract base class for implementing the Criteria pattern.
NotCriteria
OrCriteria
Abstract base class for implementing the Criteria pattern.
Memcache
Singleton that serializes to memcached.
Memory
Singleton that serializes to memory.
Redis
Singleton that serializes to Redis.
Session
Singleton that serializes to a session.
Filter
Filters allow arbitrary code to be run before or after a route is executed.
Request
RequestMethod
Representation of an http request method.
Route
Static wrapper for the Router singleton.
ControllerCommand
CLI command for generating MVC controllers with views and routes.
EmailCommand
Generate email template files
EventCommand
CLI command for generating event classes.
InitializerCommand
CLI command for generating initializer classes.
JobCommand
CLI command for generating job classes.
ListenerCommand
CLI command for generating listener classes.
InstallCommand
Install the job queue system
ScaffoldCommand
CLI command for generating complete CRUD scaffolds.
Provider
CLI provider for the Scaffolding component.
FileTemplateEngine
File-based template engine for loading stub files
MemoryTemplateEngine
In-memory template engine for testing
Temporary
Temporary file management.
Language
Singleton based language dictionary.
System
System level methods.
SystemTimer
Singleton based timer.
Template
Basic templating engine. Replaces %item% with $fields[ 'item' ].
Timer
Class for performing stopwatch functions.
WebHook
WebHookResponse
Base
Validator base class.
Collection
Allows multiple validators to be chained in one item.
IsArray
Requires an array.
IsBase64
Validates base64 encoded data.
IsBoolean
Requires a boolean.
IsCurrency
Requires a number with a maximum of 2 decimal places.
IsDate
Requires a date with a specific format. Defaults to Y-m-d
IsDateRange
Validates a DateRange data object.
IsDateTime
Requires a date with a specific format. Defaults to Y-m-d
IsDateWithinRange
Requires a date within a specified range.
IsEin
Requires a valid ein format of nn-nnnnnnn
IsEmail
Requires a valid email address format.
IsFloatingPoint
Requires a floating point number.
IsInteger
Requires an integer
IsIpAddress
Requires a valid IsIpAddress format.
IsJson
Validates json data.
IsName
Requires a valid name.
IsNotEmpty
Requires a non empty variable.
IsNotNull
Requires a non-null variable.
IsNumberWithinRange
Requires a number to be within a specific range.
IsNumeric
Requires an integer or float or a numeric string
IsNumericRange
Requires the Minimum to be less than the maximum.
IsObject
Requires an array.
IsPhoneNumber
Requires a valid phone number format nnn-nnn-nnnn
IsPositive
Requires a positive number.
IsRegExPattern
Validator base class.
IsString
Requires a string.
IsStringLength
Validator base class.
IsTime
Requires time to be in a specific format. Defaults to g:i:s A
IsUpc
Validates a UPC code.
IsUrl
Requires a valid url format.
IsUuid
Requires a valid UUID format.

Traits

HasQueueManager
Trait for CLI commands that need access to the QueueManager.
CacheableView
ObservableTrait
Trait used to make an object observable.
Policy

Functions

boot()  : Application
Bootstrap and initialize a Neuron CMS application.
sendEmail()  : bool
Send a simple email
sendEmailTemplate()  : bool
Send an email using a template
email()  : Sender
Create a new email Sender instance with fluent interface
boot()  : Scheduler|null
Initialize the application.
scheduler()  : void
Run the application.
dispatch()  : string
Dispatch a job to the queue for background processing
dispatchNow()  : mixed
Execute a job immediately (synchronously), bypassing the queue
getQueueManager()  : QueueManager
Get the queue manager instance from registry
queueSize()  : int
Get the size of a queue
clearQueue()  : int
Clear all jobs from a queue

Functions

boot()

Bootstrap and initialize a Neuron CMS application.

boot(string $configPath) : Application

This function initializes a complete CMS application with all necessary components including routing, content management, blog functionality, and site configuration. It delegates to the MVC boot function but provides CMS-specific context and naming.

Additionally initializes the ORM with the database connection from settings.

Parameters
$configPath : string

Path to the CMS configuration directory

Tags
throws
Exception

If configuration loading or application initialization fails

Return values
Application

Fully configured CMS application instance

sendEmail()

Send a simple email

sendEmail(string $to, string $subject, string $body[, bool $isHtml = true ][, ISettingSource|null $settings = null ]) : bool
Parameters
$to : string

Recipient email address

$subject : string

Email subject

$body : string

Email body content

$isHtml : bool = true

Whether the body is HTML (default: true)

$settings : ISettingSource|null = null

Optional settings source for email configuration

Tags
example

sendEmail('[email protected]', 'Welcome!', '

Welcome to our site!

');

Return values
bool

True if email was sent successfully

sendEmailTemplate()

Send an email using a template

sendEmailTemplate(string $to, string $subject, string $template[, array<string|int, mixed> $data = [] ][, ISettingSource|null $settings = null ][, string $basePath = '' ]) : bool
Parameters
$to : string

Recipient email address

$subject : string

Email subject

$template : string

Template path relative to resources/views

$data : array<string|int, mixed> = []

Data to pass to the template

$settings : ISettingSource|null = null

Optional settings source for email configuration

$basePath : string = ''

Base path for template resolution (default: current directory)

Tags
example

sendEmailTemplate( '[email protected]', 'Welcome!', 'emails/welcome', ['userName' => 'John', 'activationLink' => 'https://...'] );

Return values
bool

True if email was sent successfully

email()

Create a new email Sender instance with fluent interface

email([ISettingSource|null $settings = null ][, string $basePath = '' ]) : Sender
Parameters
$settings : ISettingSource|null = null

Optional settings source for email configuration

$basePath : string = ''

Base path for template resolution (default: current directory)

Tags
example

email() ->to('[email protected]') ->cc('[email protected]') ->subject('Order Confirmation') ->template('emails/order-confirmation', ['order' => $order]) ->attach('/path/to/invoice.pdf', 'invoice.pdf') ->send();

Return values
Sender

boot()

Initialize the application.

boot(string $ConfigPath) : Scheduler|null
Parameters
$ConfigPath : string
Tags
throws
Exception
Return values
Scheduler|null

scheduler()

Run the application.

scheduler(Scheduler $App, array<string|int, mixed> $argv) : void
Parameters
$App : Scheduler
$argv : array<string|int, mixed>
Tags
throws
Exception

dispatch()

Dispatch a job to the queue for background processing

dispatch(IJob $job[, array<string|int, mixed> $args = [] ][, string|null $queue = null ][, int $delay = 0 ]) : string
Parameters
$job : IJob

Job instance to queue

$args : array<string|int, mixed> = []

Arguments to pass to the job

$queue : string|null = null

Queue name (null = default)

$delay : int = 0

Delay in seconds before job is available

Tags
example

// Basic usage dispatch(new SendEmailJob(), ['to' => '[email protected]']);

// With specific queue dispatch(new ProcessImageJob(), ['path' => '/tmp/image.jpg'], 'images');

// Delayed job (run in 1 hour) dispatch(new SendReminderJob(), ['order_id' => 123], 'default', 3600);

Return values
string

Job ID

dispatchNow()

Execute a job immediately (synchronously), bypassing the queue

dispatchNow(IJob $job[, array<string|int, mixed> $args = [] ]) : mixed

Useful for testing or when you want to ensure a job runs in the current process without queueing.

Parameters
$job : IJob

Job instance to execute

$args : array<string|int, mixed> = []

Arguments to pass to the job

Tags
example

$result = dispatchNow(new ProcessDataJob(), ['data' => $data]);

Return values
mixed

Job result

getQueueManager()

Get the queue manager instance from registry

getQueueManager() : QueueManager

Creates a new instance if one doesn't exist.

Return values
QueueManager

queueSize()

Get the size of a queue

queueSize([string|null $queue = null ]) : int
Parameters
$queue : string|null = null

Queue name (null = default)

Tags
example

$size = queueSize(); // default queue $emailQueueSize = queueSize('emails');

Return values
int

Number of jobs in queue

clearQueue()

Clear all jobs from a queue

clearQueue([string|null $queue = null ]) : int
Parameters
$queue : string|null = null

Queue name (null = default)

Tags
example

$cleared = clearQueue('emails');

Return values
int

Number of jobs cleared


        
On this page

Search results