All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Casting support for update_values of a model, similar to laravel's casts, e.g.:
uploaded_at:date
. Supports bool, int, float, date, string, trim (a trimmed string), none (to prevent from casting empty values to NULL) - Queue daemon which can run the queue reliably twice each minute, similar to the cron daemon
- New method to generate a random filename with 25 characters:
C::Storage()->getRandomFilename()
- Redis usage in the whole system is now optional, works fine without redis at all [#40]
- The environment config file
app/app.env
is now a proper ini-file. Kept legacy support but preferred syntax is now e.g.ENVIRONMENT=Prod
.
- Garbage collector config options, improve default garbage collection in session module
- Facade classes for modules: Config, DB (eloquent connection, similar to laravel's DB facade), Log, Request, Router, Session
- New methods to delete a directory and its content:
C::Storage()->deleteDirectory($dir)
andC::Storage()->deleteFilesInDirectory($dir)
- Model methods:
beforeDelete()
+afterDelete()
, simplified cache handling on save / on delete - Set multiple request values at once via array (for
C::Request()->set([])
andC::Request()->setMultiple([])
) Charm\Storage\File
class for file related methods, added SHA256 + MD5 checksum methods- Support for multiple loggers, including logging to file, redis, syslog, process, errorlog
- Improve performance and code structure of
C::Storage()->scanDir()
and the filteredscanDirFor...()
methods - Update composer packages
- Fix URL construction in Router module for URLs with ports + fragments
- Model filtering via
filterBasedOnRequest()
andgetFilteredPaginatedData()
can now be customized with a custom callback which allows adjusting the QueryBuilder - Run cron jobs via a dedicated daemon:
bob cron:daemon start/stop/info
, works beautifully with a systemd service - Uploaded files can now directly be transformed into an
Image
object for easy image manipulation / conversion - Add base64 support for fetching multiple files in a single upload (array of base64 strings)
- Create and validate a CSRF token in a session via
C::Session()->generateCsrfToken()
- A string can now easily be escaped via
C::Formatter()->escape($str)
- New module
C::Header()
for easy handling of request / response headers with handy methods to set the most common headers directly, including CORS and security related headers - Login throttling via
C::Guard()->throttleLogin()
, check if a client is blocked viaC::Guard()->isBlocked()
- Logging of the stack trace when an exception happens during a cron job
- Replace symfony/process with exec for better detachment of cron jobs in background
- Move dev packages (debugbar, kint, phpunit, whoops) to require-dev, made their usage optional in the framework
- Failed login attempts are stored more intelligently and expired failed logins are removed automatically
- A bug when a view is rendered via CLI where the Session module is not available
- Polyfill for
apache_request_headers()
since we now have an own moduleC::Header()
- New console command
cron:info
which shows all cron jobs and allows the creation of systemd service + timer files - New console command
sys:info
which displays some basic information of the app - Caching to Model's
getFilteredPaginatedData()
- Caching to Json outputs via
Json::makeWithCache(...)
, can automatically append a unique hash based on the request - New CLI command method
$this->io->writelnVerbose($message)
to output a message only if output verbosity is verbose - CLI command helper constants for verbose output, input option and input arguments
- The formatted duration of a Performance Metric only returns the seconds if duration is below 1 minute
- The module installer is now called via
bob c:mod
and is prepared to install and uninstall modules (still WIP!) - When using
C::Cache()->remember(...)
you can now also specify optional tags to apply to the saved entry - Creating a Token via
C::Token()->createToken($length)
is now improved and returns a better string utilizing the whole alphabet instead of base64, also addingC::Token()->generateSecureToken($length)
for simple token string generation
UserModel
class which is the new base model for the app'sUser
model.- Types, refactoring and default values for EngineManager
C::Arrays()->array_merge_recursive(...)
now allows any data type as input arrays and will cast them into arrays.- When creating a
View
output object you can now access the twig environment to modify it as you like. - Model properties can now be filtered as
array_like
, so you can provide multiple values which all must be contained in the property. - When getting the current user via
C::Guard()->getUser(true)
you can now set a bool parameter to decide if the user data should be fetched from the cache (true, default) or from the database via a query (false).
- Maintenance mode commands are now
c:up
andc:down
to harmonize the namespace of charm's own CLI commands - Merge charm creator CLI commands into a single
c:new
, onlyc:env
stays the same C::Arrays()->get(...)
andC::Arrays()->has(...)
now take any type as an array input and will cast it into an array.- Add total runtime metric method and refine time measurement. You can easily get the
Metric
object of the total runtime viaC::Performance()->getTotalRuntimeMetric()
and easily adjust the start and end time ofMetric
objects. - When an error occurs while outputting the error exception will be thrown instead of a generic one. This gives you the correct stack trace for debugging, if exception throwing is enabled.
- The CLI's
$this->io
CommandHelper class now has own setters for input and output objects and can be created without any of them.
- The database migrator command
bob db:sync
now displays the stats correctly. - Command's
$this->io->choice(...)
worke fine again. - Performance tracking of CLI commands
- Dropped support for FTP filesystems (SFTP is preferred if needed at all).
- Removed kint-twig package to remove unnecessary overhead, if needed it can be added and linked manually.
- Handy ViewExtension default functions
C::Router()->constructUrl(...)
method to create custom URLs with parameters- Module specific config files can be overridden by the same config in the App (and its environment config file)
- Add custom config values via
C::Config()->set(...)
which are stored in the AppStorage for runtime only (but can also be stored in AppStorage cache depending on user's app) - Model's
filterBasedOnRequest()
can now also filter fields with custom callback, check forisnull
/notnull
C::Formatter()->removeTrailingZeros(...)
method which removes trailing zeros and dots- When using the
Smtp
driver inMailman
you can now directly access thePHPMailer
instance and the mime message as well C::Formatter()->sanitizeUrl(...)
method now easily allows to sanitize a URL.C::Arrays()->from($array)
method which creates aCArray
collection from the specified arrayC::Http()->...
for easy access to APIs. Simply make requests and work with responses. Built upon the awesome GuzzleHttp library.C::Validator()->...
module for easy validation of strings and access to versatile validations based on the awesome Respect-Validation package.- DataExporter can now export to XLSX, ODS, CSV and HTML and is working with the latest PHPSpreadsheet version
C::Request()->isSameOrigin()
method which returns bool based onHTTP_ORIGIN
and app's base URL- Maintenance mode including middleware and output handling. Use the CLI commands
cc:down
andcc:up
to turn the mode on / off or create filevar/maintenance.lock
manually. - Cron job to remove log files older than
main:logging.keep_days
days. Same for debugbar cache files aftermain:debug.log_keep_days
days. - Cron jobs can now be organized in subdirectories inside
app/Jobs/Cron
and will be loaded recursively. C::Session()->saveAndClose()
to easily write and end the session, so you can prevent session blockingC::Http()->withGenericUserAgent()->get(...)
easily allows to make requests using a generic common user agentC::Performance()->...
module to easily access key metrics of the app and to create custom measurements.- More methods to
C::Server()->...
to get different parts of uname data of the server.
- Improved security of DebugBar
C::Formatter()->translate(...)
now returns mixed data, including arraysC::Router()->getCurrentUrl($with_query_params)
now has an optional parameter to decide if you want the current URL with or without the query parameters- Refactoring of the
Arrays
module, including strict types and utilizingCArray
- Crown module now has strict type and return codes for run method (breaking changes, please adjust your cron jobs!)
- Crown module now smoothly supports multiple jobs each run which run in own threads in parallel
- For main framework access we now use the magic magnet
Charm\Vivid\C
as the default class instead of the alternative classCharm\Vivid\Charm
, which can be used as well, depending on the dev's preferences - Moved the ProgressBar class to the
Bob
module - Improved and extended the available
CommandHelper
methods EventListener
fire methods can now have a parameter passed to when the event is fired- Console commands have a new structure, now simplifying the general structure. Easy access of input and output
is possible via
$this->io->...
.
- Small bug fixes due to wrong return types
- Errors due to sequential cron job handling which led to some cron jobs which didn't run when the previous one took too long. They are now running in their own threads in parallel.
- Image handling via the
Image
class is working again, improved thumbnail generation
- Replace
$this->user
in your controllers withC::Guard()->getUser()
- Replace
$this->user->id
in your controllers withC::Guard()->getUserId()
- Replace
$this->request
in your controllers withC::Request()
- Check method signatures of all event listeners, especially:
public function fire(mixed $args = null): bool {...}
- To be future-proof, update your console commands to extend the new class
Charm\Bob\Command
and adjust the methods - Check that your cron jobs return bool and are compatible with the new return types
- CommandHelper class with handy commands to easily style input / output of console commands
- ViewExtensions are now a lot easier to create and have a common base class
- Choice display in charm creator
- Funding comment which made problems with packagist
- CharmCreator commands and handling
- Way more documentation
- Suiting, modern charm-wireframe
- Support for global
bob
command
- Structure of many modules have been changed
- Get all available cron jobs via
C::Crown()->getAllCronJobs()
- Summary of database migrations as console output
- Console commands can now also be in subdirectories of
app/Jobs/Console
- Moved console jobs to according module
- Moved database migration to own
DatabaseMigrator
class - Moved database code to own module outside the Kernel
- Deprecated view Methods (ViewExtension)
buildUrl()
(usegetUrl()
instead)formatMoney()
(useformatNumber()
instead)str_replace()
(use twig's built-in|replace()
filter instead)
- Deprecated methods
C::Formatter()->formatMoney()
(useC::Formatter()->formatNumber()
instead)C::Router()->buildUrl()
(useC::Router()->getUrl()
instead)C::Database()->getRedisClient()
(useC::Redis()->getClient()
instead)
- Deprecated
PathFinder
class - Dependency on DbDumper, we will create a native one via
mysqldump
soon - Deprecated
in_string()
function, use built-instr_contains()
instead
- First public initial commit of base system