Skip to content

Parable PHP Framework 1.1.0

Compare
Choose a tag to compare
@devvoh devvoh released this 17 May 13:05
· 28 commits to master since this release
795506d

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 of parable.
  • defines.php now sets a global constant APP_CONTEXT to either web or cli. 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 through setDefaultCommand(). It's now also possible to removeCommandByName().
  • \Parable\DI\Container gained getDependenciesFor() 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 the Response changes below for details. The config values used to load the templates are parable.layout.header and parable.layout.footer. They're expected to be .phtml files.
  • \Parable\Framework\Loader has been added, containing InitLoader and CommandLoader, 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 gained resetUser() and reset(), which calls it and revokeAuthentication() both. This makes it possible to unset the user as well.
  • \Parable\Framework\Authentication has also gained setUserIdProperty() and getUserIdProperty(), for more control over how to load users.
  • \Parable\Http\Output\OutputInterface has gained acceptsContent($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 implements acceptsContent() to return default true.
  • \Parable\Http\Output\Html overrides acceptsContent() to only accept string or null types. Json accepts all types.
  • \Parable\Http\Response has gained setHeaderContent() and setFooterContent, which are pre/appended to the content when sending. This is used by App's layout logic. Also there's getters for both.
  • \Parable\Http\Response also gained stopOutputBuffer(), which does the same as returnOutputBuffer() 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 gained whereCondition(), taking the standard $key, $comparator and optional $value (default null) 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 gained getRightsNames(), 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 the Output changes, it now checks what kind of data it is and handles it accordingly.
  • \Parable\GetSet\Base now throws an exception when getAll() 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 uses acceptsContent to make sure only valid content is set using the available output method.
  • \Parable\ORM\Model now returns all fields when exportToArray() 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.