PHPackages                             almostengr/cakephp-core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. almostengr/cakephp-core

ActiveCakephp-plugin[Framework](/categories/framework)

almostengr/cakephp-core
=======================

2026.06.07(2d ago)00GPLPHPPHP &gt;=8.1

Since Jun 8Pushed 2d agoCompare

[ Source](https://github.com/almostengr/cakephp-core)[ Packagist](https://packagist.org/packages/almostengr/cakephp-core)[ Docs](https://github.com/almostengr/cakephp-core)[ RSS](/packages/almostengr-cakephp-core/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (1)Used By (0)

Almostengr CakePHP Core
=======================

[](#almostengr-cakephp-core)

Table of Contents
-----------------

[](#table-of-contents)

- [Purpose](#purpose)
- [System Requirements](#system-requirements)
- [Installation](#installation)
- [Setup](#setup)
- [Custom Files](#custom-files)
- [Configuration](#configuration)
- [Report Bug and Feature Requests](#report-bugs-and-feature-requests)
- [License](#license)

Purpose
-------

[](#purpose)

The purpose of this project is to reduce the coding time required for building CakePHP applications. While CakePHP does come with a default styling system, I have build with Bootstrap styling for several years. Thus wanting to use that same technology with CakePHP applications that I create.

Yes the FriendsOfCake/cakephp-bootstrap project does exist, it is not always kept up with the latest version of Bootstrap. Thus could be exposed to vulnerabilties or defects take longer to be fixed, which is not an ideal scenario.

System Requirements
-------------------

[](#system-requirements)

- CakePHP 5 or later
- PHP 8.4 or later

Installation
------------

[](#installation)

To install, run the command

```
composer install almostengr/cakephp-bootstrap
```

Setup
-----

[](#setup)

### Update Controllers

[](#update-controllers)

Add the below code to the `AppController.php`, so that it will apply to all the controllers in the application.

Alternatively, you can add the below to specific controllers so that the theme is only applied to views for that controller.

```
public function beforeRender(EventInterface $event): void
{
    parent::beforeRender($event);

    $this->viewBuilder()->setTheme('AlmostengrCakephpCore');
}
```

#### Controller Methods for Modals

[](#controller-methods-for-modals)

Views that display content in modals, should have the below code at the end of the controller method:

```
$this->viewBuilder()->disableAutoLayout();
```

This code will disable the full layout from being displayed within the modal. It will only show the code that is in the defined view and Save Change and Cancel buttons.

#### Close After Modal Form Submit

[](#close-after-modal-form-submit)

In `AppController.php`, add the below method. This method should be called when there are no errors from submitting the modal forms.

```
public function noContent()
{
    return $this->response->withStatus(204)->withStringBody('');
}
```

This will return No Content 204 response to the client. When this is received, the page will refresh. Then when the form is submitted without errors, it will close the modal. Below is an example controller method.

```
public function add()
{
    $user = $this->Users->newEmptyEntity();
    if ($this->request->is('post')) {
        $user = $this->Users->patchEntity($user, $this->request->getData());
        if ($this->Users->save($user)) {
            return $this->response->withStatus(204)->withStringBody('');
        }
        $this->Flash->error(__('The user could not be saved. Please, try again.'));
    }
    $this->set(compact('user'));
    $this->viewBuilder()->disableAutoLayout();
}
```

### Plugin List

[](#plugin-list)

Be sure that the below has been added to the array in the `config/plugins.php` file.

```
    'AlmostengrCakephpCore' => [],
```

### Views

[](#views)

#### Modal Links

[](#modal-links)

To open a modal using an anchor link, use the example below.

```
