Releases: devvoh/parable
Parable PHP Framework 1.2.2
Parable PHP Framework 1.2.1
1.2.1
Bugfixes
Route::extractParameterValues()now only filters out values that are exactly an empty string. Anything else will be passed along as the provided value.Model::removeEmptyValues()has a similar issue, where now onlynullvalues are filtered out.
Parable PHP Framework 1.2.0
Parable PHP Framework Changelog
1.2.0
Changes
\Parable\Console\Optionshas been upgraded thanks to @jerry1970, through PR #44:- Flag options (single-character, using a single dash) are now supported. Examples:
parable command -xyforparable command -x -y -f. You can designate an option as a flag by passingtrueas the fourth parameter when instantiating an Option or simiarly by callingaddOption()on a command. - Flag options are only picked up when passed with a single dash
-, whereas regular options only get picked up with a double dash--. - Flag options by default don't require a value and are
nullif not passed andtrueif passed. They can, however, take values like regular options.
- Flag options (single-character, using a single dash) are now supported. Examples:
\Parable\Console\Outputhas been upgraded to support newlines in the differentwriteBlock()methods. You can also directly pass them astring[], just like withwriteln().\Parable\Http\Responsehas gainedenableHeaderAndFooterContent(), so you can disable it for certain output (like Json) if you've otherwise set header/footer content globally.
Parable PHP Framework 1.1.0
Parable PHP Framework Changelog
1.1.0
Changes
- The
parablecommand has been fixed up massively. There's now a\Parable\Framework\ConsoleAppclass, which handles the actual logic. By using this, you can offer your own command instead ofparable. defines.phpnow sets a global constantAPP_CONTEXTto eitherweborcli. This can help you figure out what context you're running in.defines.phpnow 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\Appnow also adds the command you set throughsetDefaultCommand(). It's now also possible toremoveCommandByName().\Parable\DI\ContainergainedgetDependenciesFor()so it's possible to get just an array of instantiated dependencies.\Parable\Framework\Appgained multiple hooks:HOOK_LOAD_CONFIG_BEFORE/AFTER,HOOK_LOAD_INITS_BEFORE/AFTER,HOOK_LOAD_LAYOUT_BEFORE/AFTER.\Parable\Framework\Appnow supports layouts, which are loaded just before the response is sent. See theResponsechanges below for details. The config values used to load the templates areparable.layout.headerandparable.layout.footer. They're expected to be.phtmlfiles.\Parable\Framework\Loaderhas been added, containingInitLoaderandCommandLoader, easing the use of either and separating that logic away nicely.\Parable\Framework\Package\PackageManagerwas 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\PackageInterfaceis an interface used to define a Parable Package.\Parable\Framework\Authenticationhas gainedresetUser()andreset(), which calls it andrevokeAuthentication()both. This makes it possible to unset the user as well.\Parable\Framework\Authenticationhas also gainedsetUserIdProperty()andgetUserIdProperty(), for more control over how to load users.\Parable\Http\Output\OutputInterfacehas 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\AbstractOutputwas added, which implementsacceptsContent()to return defaulttrue.\Parable\Http\Output\HtmloverridesacceptsContent()to only acceptstringornulltypes.Jsonaccepts all types.\Parable\Http\Responsehas 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\Responsealso 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\Queryhas gainedwhereCondition(), taking the standard$key,$comparatorand optional$value(defaultnull) and$tableName. This was added to ease adding simple wheres, without having to always build a condition set.\Parable\ORM\Query\ConditionSetnow accepts a 4th parameter, which is$tableName, in case you want to check against a different table's values.\Parable\Rights\Rightshas gainedgetRightsNames(), which will return the names of all rights configured.
Bugfixes
\Parable\Console\Outputhas 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\Apphas 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\Appnow loads the database immediately after loading the Config, instead of much later.\Parable\Framework\Dispatcherdidn't check route return values and blindly attempted to string-concatenate them. With the help of theOutputchanges, it now checks what kind of data it is and handles it accordingly.\Parable\GetSet\Basenow 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\Responsenow checks whether it's possible to append output buffers to content, and usesacceptsContentto make sure only valid content is set using the available output method.\Parable\ORM\Modelnow returns all fields whenexportToArray()is called and no$model->exportablevalues 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.
Parable PHP Framework 1.0.0
Parable PHP Framework Changelog
1.0.0
This release brings a major clean-up, documentation, useful new functionality and far more consistency.
If you're new to Parable, welcome! None of this is relevant for you, install and enjoy!
If you're upgrading from 0.12.x, this will be quite a whopper of a changelog for you to dig through, but it will definitely be worth it. Most changes are easily made (a test upgrade of an older 0.12.3 app I was working on took about 20 minutes) and it's much more complete than any previous versions.
Changes
- All method doc blocks now have explanatory text, even if it's superfluous, for documentation purposes.
\Parable\Console\Appnow supports adding multiple commands in one go, usingaddCommands([...]).\Parable\Console\Command\Helpnow can generate a string for the usage of a command. Try it yourself:vendor/bin/parable help init-structure. Usage is also added to any exception caught by\Parable\Console\App's exception handler.\Parable\Console\Inputreceived the following updates:\Parable\Console\Input::getKeyPress()has been added. It will wait for a single key press and return its value immediately. Special characters like arrow keys, escape, enter, etc, will be returned as a string value accordingly.\Parable\Console\Input::enableShowInput()and its buddydisableare now available for you to use. If disabled, hides the user's input as they enter it.Inputwill call theenableon destruct to prevent its effects lingering after exiting the script.\Parable\Console\Input::enableRequireReturn()and its buddydisableare now available for you to use as well. If disabled, no longer requires an enter before returning input.
\Parable\Console\Outputreceived the following updates:\Parable\Console\Output::writeBlockWithTags()was added, making it possible to write a block with multiple tags.\Parable\Console\Output::getTerminalWidth()will return the columns available in the current terminal window.getTerminalHeight()will return the lines available.\parable\Console\Output::isInteractiveShell()will return whether the script is running in an interactive terminal session or not.
\Parable\Console\Parameterhas been rewritten, and options and arguments are no longer just arrays of data, but actual classes. This allows much more fine-grained control over whether, for example, an option has been provided but there's no value to go with it.\Parable\Framework\Appreceived the following updates:- It now has a
HOOK_LOAD_ROUTES_NO_ROUTES_FOUNDconstant and triggers it when, you guessed it, no routes are found. - Quickroutes! It now has
get(),post(),put(),patch(),delete(),options(),any()andmultiple()methods, so there's an easy way of defining callback routes without having to set up the entire structure.any()accepts literally any method, or you can pass an array of the methods tomultiple()as its first parameter. - Quickroutes also accept
["controller", "action"]style callbacks and will set them as discretecontrollerandactionvalues on a route if the action is not a static function, to keep load down. - It also has
setErrorReportingEnabled($bool)andisErrorReportingEnabled(). By default it's set to off. You can addparable.debugto the Config and set it to true to enable it. - It can now set the default timezone if you add a
parable.timezonevalue to the config.
- It now has a
\Parable\Framework\Dispatcherreceived the following updates:- It can now return the route it dispatched by calling
getDispatchedRoute(). - It now triggers two more events:
HOOK_DISPATCH_TEMPLATE_BEFOREandHOOK_DISPATCH_TEMPLATE_AFTER. Use this to do something between a controller/callable being called and the template being loaded.
- It can now return the route it dispatched by calling
\Parable\Framework\Mailernow supports setting a different mail sender. Default is, as it was, php's ownmail().\Parable\Framework\Mailernow can act on three config values:parable.mail.sender, which should be the class name of theSenderInterfaceimplementation you want to use.parable.mail.from.email, the email for the for address.parable.mail.from.name, the name for the for address.
\Parable\Framework\Viewnow accepts more classes to be registered for use within Views. Call$view->registerClass($property, $className)and you can do$this->property_name->stuff()in your views.\Parable\GetSet\Basenow also hassetResource, for when you want to switch, or set it using a method rather than overwriting a property.\Parable\GetSet\Base::get()now accepts a second parameter$defaultwhich is the value to return when the requested$keyis not found. Added by @dmvdbrugge in PR #30. Thanks!\Parable\Http\Requestnow hasisOptions()to check for OPTIONS method requests.\Parable\Http\Requestnow has constants for all methods and all accepted methods are inRequest::VALID_METHODS.\Parable\Http\Responsenow hassetHeaders()so you can add a bunch of headers in one call,removeHeader($key)so you can remove a header, andclearHeaders()to, y'know, actually, I think you got this.\Parable\Http\Response::clearContent()was added, in case you want to just want to callappendContent()multiple times rather than onesetContent()and then those appends.\Parable\Log\Writer\NullLoggerwas added, for when you want to log nowhere at all.\Parable\Mail\Mailernow obviously also supports setting a Mail Sender. Default is, well, none. That's all up to you to configure. (Hey, psst,Framework\Maileralready tries to do that for you!)\Parable\ORM\Model::create()has been added, making it much easier to instantiate a model.$user = \Model\User::create()is now possible.\Parable\ORM\Repository::createForModel()has been added, and will return a Repository instance for an already instantiated model.\Parable\ORM\Repository::getByCondition()has lost its 4th parameter$andOr, as it would always be a single condition and neither AND nor OR would ever come into play.\Parable\ORM\Repository::reset()has been added, and will reset Order by, Limit & Offset, only count and return one/all to their default values.\Parable\ORM\Queryno longer supports setting the table key. This hadn't been necessary for a while, but the last remaining use of it has been removed. This shouldn't impact anyone much.\Parable\Routing\Routereceived the following updates:- In
setUrl(), it now prepends a '/' if it isn't provided. Now you can add a url without the prepended slash if you find that cleaner. - It now makes sure all methods set on it are uppercase, for more consistent matching.
- It now receives its own name and can be retrieved by calling
getName()on it. - It now has
setValues(), in case you want to overwrite all values. These will be passed to the controller or callable, in order. This makes it possible to intercept a dispatch and inject, for example, the request or response objects in addition to the parameter values from the url. - It now has
createFromDataArray(), which can be used to create aRouteobject from the same type of data set in theRoutingfile in the structure.
- In
\Parable\Routing\Routernow has agetRoutes()method that returns all set routes. In case you, err, need that.dynamicReturnTypeMeta.jsonhas been added, removing the need for/** @var \Class $var */references in the code. This works with the dynamic return type plugin in PhpStorm. Removed the few existing references that were there.- It's now possible to set a new config value -
parable.database.soft-quotes- to eithertrue(default) orfalse. Iftrue, Parable will fake quotes for values if there's no database instance available. If set tofalse, it'll refuse to quote instead.
Backwards-incompatible Changes
Bootstrap.phphas been removed.\Parable\Framework\Apphandles its own setup now. This makes it easier to implement App without much hassle.SessionMessagehas been moved from theGetSetcomponent intoFramework, as it isn't aGetSetinstance itself but merely uses theSessioninstance.\Parable\Consoleno longer accepts options in the format--option value, but only in the following:--option=value. This is because if you had an option which didn't require a value, and was followed by an argument, the argument would be seen as the option's value instead.\Parable\Console\App::setDefaultCommand()now takes a command instance rather than the name, as the name would suggest. To set the default command by name, usesetDefaultCommandByName()instead.\Parable\Console\App::setOnlyUseDefaultCommand()was added, and the boolean paramater was removed from thesetDefaultCommand/ByName()function calls. Checked by callingshouldOnlyUseDefaultCommand().\Parable\Console\Command::addOption()andaddArgument()no longer take booleans forrequiredorvalueRequiredbut constants. See\Parable\Console\Parameterfor the values. This adds theOPTION_VALUE_PROHIBITEDpossibility. Options can no longer be made required.\Parable\Console\Parameterhas received several constants:PARAMETER_OPTIONAL,PARAMETER_REQUIRED,OPTION_VALUE_OPTIONALandOPTION_VALUE_REQUIRED. This replaces the boolean functionality Parable had before. This makes it more readable.\Parable\Console\Parameter::setOptions()was renamed tosetCommandOptions(), because the distinction is important.\Parable\Console\Output::writeError/writeInfo/writeSuccess()are now suffixed withBlock, sowriteInfoBlock(), etc.\Parable\DI\Container::cleanName()has been made protected. This shouldn't impact you, as you shouldn't've been using it in the first place.\Parable\Framework\Dispatcherno longer passes the Route to ac...
Parable PHP Framework 0.12.14
Parable PHP Framework Changelog
0.12.14
Changes
/bin/vendor/parable, the command-line tool, now shows the Parable version.\Parable\Rights\Rightshas an improvedcombine()method and gainedgetRightsFromNames()andgetNamesFromRights()methods, so it's easier to work with.\Parable\Framework\Apphas lost its dependency on\Parable\Filesystem\Path, since it became obsolete after recent changes.\Parable\ORM\Querynow hasaddValues(), so you can add an array of values instead of having to do them one-by-one.\Parable\ORM\Repositorynow hascreateInstanceForModelName(), which is now whatToolkit::getRepositorycalls as well. Toolkit'sgetRepositoryis sticking around, since it's more useful in views.- Small fixes to increase code base quality.
Bugfixes
- The
parable init-structurecommand used a hard-coded vendor path, which could eventually cause problems. - Fixed tests up so that all components have 100% code coverage without
Frameworktouching all the things. Also improved and simplified some tests.
Parable PHP Framework 0.12.13
Parable PHP Framework Changelog
0.12.13
Changes
- To ease development a little, try
make serveron amake-enabled OS (or run the php built-in webserver yourself withphp-server.phppassed as router script) and it will run (by default) onhttp://localhost:5678. \Parable\Console\ParameterandCommandnow understand that even arguments deserve default values. Third (optional) parameter added toaddArgumentthat will allow for a default value.- 5 whitespace issues fixed, based on feedback from StyleCI, using the PSR-2 preset. These were the only(!) style discrepancies found.
Bugfixes
Undefined offsetfixed in\Parable\Console\Parameter::checkArguments(). Requesting arguments that weren't provided no longer results in a notice.
Parable PHP Framework 0.12.12
Parable PHP Framework Changelog
0.12.12
Bugfixes
- Bug in
\Parable\\Routing\Route::isPartCountSame($url), where trailing slash vs no trailing slash would be considered not the same. Fixed in PR #25 by @jerry1970.
Parable PHP Framework 0.12.11
Parable PHP Framework Changelog
0.12.11
Bugfixes
- I can't believe nobody noticed this yet, but there was a bug in
\Parable\ORM\Query::buildOrderBy(), where the key is actually escaped throughquoterather thanquoteIdentifier, leaving it as a quoted value rather than a key. - Also
buildGroupBy(), grmbl.
Parable PHP Framework 0.12.10
Parable PHP Framework Changelog
0.12.10
Changes
\Parable\GetSet\Basealso got some love. Now, like in\Parable\Framework\Config, it's possible to get nested array values with the dot-notation. To get$resource["one"]["two"], you can now use$config->get("one.two");. This of course works for all GetSet implementations, so also Post and Get.$getSet->remove()also supports this notation now.\Parable\GetSet\Basecan do the same with set now. So to set (and create all currently non-existing) nested keys, you can do this$config->set("one.two.three", "value");.- Since this copies the functionality already built into
\Parable\Framework\Config, that class has now become an implementation of\Parable\GetSet\Base, making it all work exactly the same.