cakephp-shim

CakePHP plugin to "shim" functionality up and down for major versions of the framework.

MIT License

Downloads
760.3K
Stars
37
Committers
6
cakephp-shim - CakePHP 3.x: The Shimming has begun

Published by dereuromark over 9 years ago

With this first release for CakePHP 3.x it is now easier than ever to upgrade existing CakePHP 2.x apps to the next major version.
You might already have shimmed your 2.x project using the corresponding branch of this plugin to ease migration upwards, but even without that you can leverage many of the included shims to make the upgrading process smoother and faster.

The idea:

  • Only modify what is absolutely necessary, shim a lot of things in the meantime and save time.
  • Then once you made it run again, maybe even added more functionality/tests in the process, you have time to - piece by piece - refactor the shimmed parts if you like (any time you like).

Shims include

  • The controller layer
  • The model layer (validation, relations!)
  • The view layer (around helpers)
  • Help on reporting issues and warn about missing migration steps

Many more shims are included in the 2.x branch already, so bottom line, if you want to save time and resources:
In case you know you want to upgrade your 2.x app to 3.x, but it will still take a few months, maybe look ahead, use the tips provided (incl. the official migration guide on top) to avoid additional work in the future, use the 2.x Shim plugin versions in your project already and prepare for the upgrade as best as possible.

Happy baking!

cakephp-shim - CakePHP 2.x: Adding new shims

Published by dereuromark over 9 years ago

Better mobile detection

RequestHandlerComponent backport into 2.x for isMobile() and isTablet() using an up-to-date vendor library.
In order to use that, you will need to composer require "mobiledetect/mobiledetectlib": "2.*".

JsonView _jsonOptions

Backport of _jsonOptions support for 2.x as well as setting the 3.x defaults here as well (JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT).
When upgrading your code to 3.x the output then doesn't change. These 4 flags are recommended to comply to RFC4627.

See the docs for details.

cakephp-shim - Small BC fix

Published by dereuromark over 9 years ago

Conditionally deprecate better to allow people to react in time.

cakephp-shim - Getting closer to 3.x

Published by dereuromark over 9 years ago

  • Add assertRedirectContains()
  • Deprecate Model::hasAny()
  • Add UrlShimHelper for Url::build() and alike

With the last addition you can then use $this->Url->build() (instead of $this->Html->url()) already in 2.x.
Using the MyUpgrade shell command cake Upgrade.MyUpgrade shim you can automate the migration.

cakephp-shim - Minor fixes

Published by dereuromark over 9 years ago

Only disable recursive property with 'Shim.disableRecursive' Configure value set to avoid BC issues.
Also fixed a small session issue.

cakephp-shim - Added path assertions

Published by dereuromark over 9 years ago

Use Configure::write('Shim.checkPaths', true); to assert that all paths are correctly set up, including a trailing DS and the correct directory separator (as DS constant).

cakephp-shim - Adding Routing Speedup and more wrapper methods

Published by dereuromark over 9 years ago

Fixed

  • get() typehints

Added

  • Routing speedup via precompiled and cached routes.php file.
  • record() convenience wrapper.
  • Components' and behaviors' convenience wrappers for 3.x.
  • primaryKey(), displayField(), alias() and table() wrappers for 3.x.
  • Relation on-the-fly setup wrappers via hasOne(), hasMany(), belongsTo(), belongsToMany().
  • PHP5.6 builds in test matrix
cakephp-shim - Minor fixes and improvements

Published by dereuromark over 9 years ago

Fixed

  • field() shim + deprecation info

Added

  • saveField() deprecation info
cakephp-shim - Add more shims/functionality

Published by dereuromark over 9 years ago

Added:

  • field() shim
  • Named param redirects/handling
  • Dedicated ShimException
  • SEO duplicate content prevention

Fixed:

  • Consistent "contain" / "recursive reset" for all find(), field() and paginate() calls.

Please note:

The Configure namespace has been changed from App to Shim.
Make sure you adjust it in your bootstrap/configs.

cakephp-shim - Test, Model and Helper additions

Published by dereuromark over 9 years ago

FormHelper and Html

Some detection shims have been added to find left-overs of the deprecated $confirmMessage param used.

Model

get() has been added to quickly retrieving records in controller actions (backport of 3.x).

IntegrationTestCase

assertResponseSuccess() added for 2xx/3xx range check (backport of 3.x).

cakephp-shim - IntegrationTestCase additions

Published by dereuromark over 9 years ago

Added two convenience methods for IntegrationTestCase:

  • assertResponseNotEmpty()
  • assertResponseEmpty()
cakephp-shim - Initial 2.x release

Published by dereuromark over 9 years ago

This plugin is mainly a shim towards 3.x when you are still forced to use 2.x for a while.
It helps the migration process and provides tools to detect and resolve deprecations.

It also addresses some core issues and provides possible fixes or workarounds.

Package Rankings
Top 2.45% on Packagist.org
Badges
Extracted from project README
CI Coverage Minimum PHP Version Coding Standards