Parable PHP Framework 1.1.0
Parable PHP Framework Changelog
1.1.0
Changes
- The
parable
command has been fixed up massively. There's now a\Parable\Framework\ConsoleApp
class, which handles the actual logic. By using this, you can offer your own command instead ofparable
. defines.php
now sets a global constantAPP_CONTEXT
to eitherweb
orcli
. This can help you figure out what context you're running in.defines.php
now also defines a new function:register_parable_package()
. This can be used by external Parable Packages to register themselves with Parable at the soonest possible moment. See below for details.\Parable\Console\App
now also adds the command you set throughsetDefaultCommand()
. It's now also possible toremoveCommandByName()
.\Parable\DI\Container
gainedgetDependenciesFor()
so it's possible to get just an array of instantiated dependencies.\Parable\Framework\App
gained multiple hooks:HOOK_LOAD_CONFIG_BEFORE
/AFTER
,HOOK_LOAD_INITS_BEFORE
/AFTER
,HOOK_LOAD_LAYOUT_BEFORE
/AFTER
.\Parable\Framework\App
now supports layouts, which are loaded just before the response is sent. See theResponse
changes below for details. The config values used to load the templates areparable.layout.header
andparable.layout.footer
. They're expected to be.phtml
files.\Parable\Framework\Loader
has been added, containingInitLoader
andCommandLoader
, easing the use of either and separating that logic away nicely.\Parable\Framework\Package\PackageManager
was added, allowing external packages to register themselves with Parable before Parable is actually completely set up. Packages are loaded before config and anything else. They get to use the hooks mentioned above.\Parable\Framework\Package\PackageInterface
is an interface used to define a Parable Package.\Parable\Framework\Authentication
has gainedresetUser()
andreset()
, which calls it andrevokeAuthentication()
both. This makes it possible to unset the user as well.\Parable\Framework\Authentication
has also gainedsetUserIdProperty()
andgetUserIdProperty()
, for more control over how to load users.\Parable\Http\Output\OutputInterface
has gainedacceptsContent($content)
, which will return a boolean for whether it accepts a type of content or not.\Parable\Http\Output\OutputInterface::prepare()
now has to return a string value. Always. Exception thrown if not. This makes Output behavior expected.D\Parable\Http\Output\AbstractOutput
was added, which implementsacceptsContent()
to return defaulttrue
.\Parable\Http\Output\Html
overridesacceptsContent()
to only acceptstring
ornull
types.Json
accepts all types.\Parable\Http\Response
has gainedsetHeaderContent()
andsetFooterContent
, which are pre/appended to the content when sending. This is used byApp
's layout logic. Also there's getters for both.\Parable\Http\Response
also gainedstopOutputBuffer()
, which does the same asreturnOutputBuffer()
but doesn't return anything.stopAllOutputBuffers()
pretty much does what it says.\Parable\ORM\Query
's join methods now all accept a new optional parameter,$tableName
. Normally, the table name is set to the table already set on the query. But now you can override it. This makes it possible to join tables with other tables, neither of which are forced to be the main table.\Parable\ORM\Query
has gainedwhereCondition()
, taking the standard$key
,$comparator
and optional$value
(defaultnull
) and$tableName
. This was added to ease adding simple wheres, without having to always build a condition set.\Parable\ORM\Query\ConditionSet
now accepts a 4th parameter, which is$tableName
, in case you want to check against a different table's values.\Parable\Rights\Rights
has gainedgetRightsNames()
, which will return the names of all rights configured.
Bugfixes
\Parable\Console\Output
has had its tags fixed up. It's now possible to combine fore- and background colors, as was always intended. Some small typo fixes in the tag names, but they're easy to fix.\Parable\Framework\App
has lost some classes from its constructor. They're now loaded on an as-needed basis. So if you don't need the session, it won't be loaded, for example.\Parable\Framework\App
now loads the database immediately after loading the Config, instead of much later.\Parable\Framework\Dispatcher
didn't check route return values and blindly attempted to string-concatenate them. With the help of theOutput
changes, it now checks what kind of data it is and handles it accordingly.\Parable\GetSet\Base
now throws an exception whengetAll()
is called for a global resource type, but the resource doesn't exist. Example case: attempting to use session data before the session is started.\Parable\Http\Response
now checks whether it's possible to append output buffers to content, and usesacceptsContent
to make sure only valid content is set using the available output method.\Parable\ORM\Model
now returns all fields whenexportToArray()
is called and no$model->exportable
values are actually available. Remember, Parable's not here to hold your hand. You're responsible for only exporting the right data!
Parable Packages Information
Parable Packages are rather simple. Say you want to build something that relies on and extends Parable. If so, just create a class that implements PackageInterface
, implement the methods defined there, and in your composer.json, make sure that under autoload
/files
it loads a php file (after defines.php
itself is loaded) that calls register_parable_package()
(as defined in Parable's own defines.php
) and passes the name of your package file.
Parable will attempt to load the commands and inits defined in your parable package file, and they'll be available from the start of the application's runtime. The commands will be available from the default parable
command as well.
More details will be added to the documentation soon.