Skip to content

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

License

Notifications You must be signed in to change notification settings

cletsimon/cakephp-shim

 
 

Repository files navigation

Shim plugin for CakePHP

CI Coverage Latest Stable Version Minimum PHP Version License Total Downloads Coding Standards

Shim plugin to "shim" functionality up and down for CakePHP major versions. It also provides some small app-specific fixes.

This branch is for shimming 3.x in 4.x

It provides compatibility wrapper access to 3.x functionality in 4.x.

This is mainly useful when upgrading large applications to the next major framework version. Tons of code needs to be adjusted, using this Shim plugin quite a few lines less need to be touched. Especially the ORM layer, which would need heavy refactoring, requires a lot less changes to get things working again.

This branch is for use with CakePHP 4.2+. For details see version map.

Installation

Please see Install.md

Usage

Please see Docs.

A full overview of all shimming between versions can be found in the Wiki.

New shims

  • Controller setup for components and helpers
  • FormHelper BC for datetime (details).

Existing shims from 3.x

  • Nullable behavior for better data consistency.
  • Table::field() support and fieldByConditions() alias to migrate to.
  • Still supports model properties $primaryKey, $displayField, $order, $validate, $actsAs and all relations ($belongsTo, $hasMany, ...) as it would be very time-consuming to manually adjust all those.
  • Auto-adds Timestamp behavior if created or modified field exists in table.

Helpful links

When planning to upgrade, you should look into upgrade app for 3.x/4.x as well as the rector tool. They both contain tons of more ideas on how to get code aligned with the current direction of the framework to reduce friction in the long run.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%