qobo / project-template-cakephp
Template for new CakePHP projects
Installs: 328
Dependents: 0
Suggesters: 0
Security: 0
Stars: 21
Watchers: 19
Forks: 9
Open Issues: 3
Type:project
Requires
- aws/aws-sdk-php: ^3.52
- brainmaestro/composer-git-hooks: ^2.4
- cakedc/users: ~8.5.0
- cakephp/cakephp: ^3.8
- cakephp/plugin-installer: ^1.1
- composer/composer: ^1.7
- dereuromark/cakephp-databaselog: ^2.1
- dereuromark/cakephp-whoops: ^0.1.2
- lasserafn/php-initial-avatar-generator: ^4.0
- pelago/emogrifier: ^1.2
- pyrech/composer-changelogs: ^1.4
- qobo/cakephp-csv-migrations: ^38.0
- qobo/cakephp-groups: ^11.0
- qobo/cakephp-menu: ^16.0
- qobo/cakephp-roles-capabilities: ^v18.0
- qobo/cakephp-search: ^22.0
- qobo/cakephp-utils: ^13.0
- qobo/qobo-robo: ^2.0
- qobo/qobo-robo-cakephp: ^2.0
Requires (Dev)
- qobo/cakephp-composer-dev: ^v1.1
Suggests
- markstory/asset_compress: An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.
- dev-master
- v51.4.0
- v51.3.0
- v51.2.0
- v51.1.0
- v51.0.1
- v51.0.0
- v50.3.0
- v50.2.3
- v50.2.2
- v50.2.1
- v50.2.0
- v50.1.2
- v50.1.1
- v50.1.0
- v50.0.0
- v49.0.0
- v48.6.0
- v48.5.0
- v48.4.0
- v48.3.0
- v48.2.0
- v48.1.1
- v48.1.0
- v48.0.0
- v47.5.x-dev
- v47.5.1
- v47.5.0
- v47.4.2
- v47.4.1
- v47.4.0
- v47.3.1
- v47.3.0
- v47.2.2
- v47.2.1
- v47.2.0
- v47.1.1
- v47.1.0
- v47.0.0
- v46.1.2
- v46.1.1
- v46.1.0
- v46.0.0
- v45.4.4
- v45.4.3
- v45.4.2
- v45.4.1
- v45.4.0
- v45.3.1
- v45.3.0
- v45.2.1
- v45.2.0
- v45.1.0
- v45.0.0
- v44.0.2
- v44.0.1
- v44.0.0
- v43.2.1
- v43.2.0
- v43.1.1
- v43.1.0
- v43.0.5
- v43.0.4
- v43.0.3
- v43.0.2
- v43.0.1
- v43.0.0
- v42.0.2
- v42.0.1
- v42.0.0
- v41.5.0
- v41.4.0
- v41.3.0
- v41.2.0
- v41.1.0
- v41.0.0
- v40.4.2
- v40.4.1
- v40.4.0
- v40.3.3
- v40.3.2
- v40.3.1
- v40.3.0
- v40.2.0
- v40.1.0
- v40.0.1
- v40.0.0
- v39.15.1
- v39.15.0
- v39.14.0
- v39.13.0
- v39.12.0
- v39.11.0
- v39.10.1
- v39.10.0
- v39.9.3
- v39.9.2
- v39.9.1
- v39.9.0
- v39.8.3
- v39.8.2
- v39.8.1
- v39.8.0
- v39.7.0
- v39.6.0
- v39.5.1
- v39.5.0
- v39.4.0
- v39.3.0
- v39.2.2
- v39.2.1
- v39.2.0
- v39.1.0
- v39.0.0
- v38.2.7
- v38.2.6
- v38.2.5
- v38.2.4
- v38.2.3
- v38.2.2
- v38.2.1
- v38.2.0
- v38.1.0
- v38.0.8
- v38.0.7
- v38.0.6
- v38.0.5
- v38.0.4
- v38.0.3
- v38.0.2
- v38.0.1
- v38.0.0
- v37.3.0
- v37.2.0
- v37.1.1
- v37.1.0
- v37.0.9
- v37.0.8
- v37.0.7
- v37.0.6
- v37.0.5
- v37.0.4
- v37.0.3
- v37.0.2
- v37.0.1
- v37.0.0
- v36.3.0
- v36.2.0
- v36.1.0
- v36.0.0
- v35.5.1
- v35.5.0
- v35.4.1
- v35.4.0
- v35.3.0
- v35.2.1
- v35.2.0
- v35.1.2
- v35.1.1
- v35.1.0
- v35.0.0
- v34.1.1
- v34.1.0
- v34.0.2
- v34.0.1
- v34.0.0
- v33.0.3
- v33.0.2
- v33.0.1
- v33.0.0
- v32.13.3
- v32.13.2
- v32.13.1
- v32.13.0
- v32.12.2
- v32.12.1
- v32.12.0
- v32.11.0
- v32.10.2
- v32.10.1
- v32.10.0
- v32.9.0
- v32.8.3
- v32.8.2
- v32.8.1
- v32.8.0
- v32.7.1
- v32.7.0
- v32.6.3
- v32.6.2
- v32.6.1
- v32.6.0
- v32.5.1
- v32.5.0
- v32.4.1
- v32.4.0
- v32.3.0
- v32.2.3
- v32.2.2
- v32.2.1
- v32.2.0
- v32.1.2
- v32.1.1
- v32.1.0
- v32.0.0
- v31.4.3
- v31.4.2
- v31.4.1
- v31.4.0
- v31.3.0
- v31.2.5
- v31.2.4
- v31.2.3
- v31.2.2
- v31.2.1
- v31.2.0
- v31.1.1
- v31.1.0
- v31.0.0
- v30.1.0
- v30.0.0
- v29.0.3
- v29.0.2
- v29.0.1
- v29.0.0
- v28.4.0
- v28.3.6
- v28.3.5
- v28.3.4
- v28.3.3
- v28.3.2
- v28.3.1
- v28.3.0
- v28.2.1
- v28.2.0
- v28.1.2
- v28.1.1
- v28.1.0
- v28.0.4
- v28.0.3
- v28.0.2
- v28.0.1
- v28.0.0
- v27.1.1
- v27.1.0
- v27.0.1
- v27.0.0
- v26.0.3
- v26.0.2
- v26.0.1
- v26.0.0
- v25.0.1
- v25.0.0
- v24.1.0
- v24.0.6
- v24.0.5
- v24.0.4
- v24.0.3
- v24.0.2
- v24.0.1
- v24.0.0
- v23.0.1
- v23.0.0
- v22.1.0
- v22.0.0
- v21.2.0
- v21.1.2
- v21.1.1
- v21.1.0
- v21.0.1
- v21.0.0
- v20.2.1
- v20.2.0
- v20.1.1
- v20.1.0
- v20.0.2
- v20.0.1
- v20.0.0
- v19.1.5
- v19.1.4
- v19.1.3
- v19.1.2
- v19.1.1
- v19.1.0
- v19.0.0
- v18.0.0
- v17.0.5
- v17.0.4
- v17.0.3
- v17.0.2
- v17.0.1
- v17.0.0
- v16.2.1
- v16.2.0
- v16.1.0
- v16.0.0
- v15.1.0
- v15.0.1
- v15.0.0
- v14.1.4
- v14.1.3
- v14.1.2
- v14.1.1
- v14.1.0
- v14.0.1
- v14.0.0
- v13.1.0
- v13.0.2
- v13.0.1
- v13.0.0
- v12.0.0
- v11.9.3
- v11.9.2
- v11.9.1
- v11.9.0
- v11.8.0
- v11.7.0
- v11.6.0
- v11.5.0
- v11.4.1
- v11.4.0
- v11.3.3
- v11.3.2
- v11.3.1
- v11.3.0
- v11.2.1
- v11.2.0
- v11.1.0
- v11.0.0
- v10.0.4
- v10.0.3
- v10.0.2
- v10.0.1
- v10.0.0
- v9.0.0
- v8.2.0
- v8.1.0
- v8.0.0
- v7.0.0
- v6.0.1
- v6.0.0
- v5.7.1
- v5.7.0
- v5.6.1
- v5.6.0
- v5.5.0
- v5.4.1
- v5.4.0
- v5.3.2
- v5.3.1
- v5.3.0
- v5.2.2
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.2
- v5.0.1
- v5.0.0
- v4.0.1
- v4.0.0
- v3.2.1
- v3.2.0
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v2.2.0
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/add-v2-config-file
- dev-task-17472-Update-help-tooltip
- dev-task-17518-more-phpcs-rules
- dev-task-16680-Color-picker
- dev-generate-module-fix
- dev-task-17130-settings-search
- dev-cakephp-v38
- dev-task-11513-escape-job-options
- dev-task-16681-limit-number-of-files-to-be-uploads
- dev-task-16411-update-settings
- dev-task-16582-Avoid-XSS
- dev-task-16473-fix-labels-for-search
- dev-task-16595-improve-user-profile-links
- dev-task-15955-image-thumbnails-in-datatables
- dev-task-16415-switch-to-module-classes-2
- dev-composer-updates
- dev-task-3321-make-api-error-messages-user-friendly
- dev-task-15751
- dev-task-15480-helper-tooltip
- dev-task-15909-schedule-jobs-menu
- dev-task-15019
- dev-task-15882-translate-help-option-in-fields-json
- dev-task-15845-add-search-example-criteria-and-update-criteria-field-values
- dev-task-14136-update-search-plugin
- dev-task-15637-link-permissions
- dev-task-15310-settings-value-length
- dev-task-14872-dashboard-sequence-2
- dev-task-13039-basic-admin-settings-2
- dev-task-11957-Access-log-read-poc
- dev-add-id-to-lookup-by-default
- dev-check-correct-batch-flag
- dev-task-2555-soft-delete
This package is auto-updated.
Last update: 2021-08-23 06:09:35 UTC
README
About
This is a template for the new CakePHP projects.
Developed by Qobo, used in Qobrix.
Install
There are two ways to install and start using this project template.
Composer
You can create a new project from this template using composer.
composer create-project qobo/project-template-cakephp example.com cd example.com ./bin/build app:install DB_NAME="app",PROJECT_NAME="My Project",PROJECT_VERSION="v1.0.0"
Git
Alternatively, if you want to be able to update your project to the latest version of the template, you can install the template with git.
mkdir example.com cd example.com git init # Pull the latest version from https://github.com/QoboLtd/project-template-cakephp/releases git pull git@github.com:QoboLtd/project-template-cakephp.git vX.Y.Z composer update ./bin/build app:install DB_NAME="app",PROJECT_NAME="My Project",PROJECT_VERSION="v1.0.0" # Add your own remote repository git remote add origin git@github.com/USER/REPO # Push git push origin master
With the above approach, you have the full history of the template development. You can do your own development now, and upgrade to the latest template at any point in the future.
Update
If you installed the project template using git, you can easily upgrade your application to the latest template with the following:
cd exmample.com # Make sure you are on the master branch and have a clean and up-to-date workspace git checkout master git pull origin master # Create a new branch git checkout -b project-template-update # Pull the latest version from https://github.com/QoboLtd/project-template-cakephp/releases git pull git@github.com:QoboLtd/project-template-cakephp.git vX.Y.Z composer update ./bin/build app:update # Check for conflicts, resolve if any, commit, and then push git push origin project-template-update # Create a pull request, review, and merge
Usage
PHP
Now that you have the project template installed, check that it works before you start working on your changes. Fire up the PHP web server:
./bin/phpserv
Or run it on the alternative port:
./bin/phpserv -H localhost -p 9000
In your browser navigate to http://localhost:8000. You should see the login page. If you do, all parts are in place.
Now you can develop your PHP project as per usual, but with the following advantages:
- Support for PHP built-in web server
- Per-environment configuration using
.env
file, which is ignored by git - Powerful build system (Robo) integrated
- Composer integrated with
vendor/
folder added to.gitignore
. - PHPUnit integrated with
tests/
folder and example unit tests. - Sensible defaults for best practices - favicon.ico, robots.txt, MySQL dump, Nginx configuration, GPL, etc.
For example, you can easily automate the build process of your application
by modifying the included Robo files in build/
folder. Run the following
command to examine available targets:
./bin/build
As you can see, there are already some placeholders for your application's build process. By default, it is suggested that you have these:
app:install
- for installation process of your application,app:update
- for the update process of the already installed application, andapp:remove
- for the application removal process and cleanup.
You can, of course, add your own, remove these, or change them any way you want. Have a look at Robo documentation for more information on how to use these targets and pass runtime configuration parameters.
JavaScript
Template uses VueJS as main JS library. We're slowly abandoning jQuery codebase, transferring everything into Vue components.
In order to run JS part of the code, especially if you want to check how module Search is working, you have to compile JS components first.
Project will be relying on LTS releases of NodeJS. You can follow this instruction to set Node and npm on your machine.
You have to install all required modules from package.json
with this command:
npm install
We provide package-lock.json
in project-template-cakephp
to ensure that the codebase
is properly tested against these versions.
Inside package.json
you can find main script commands in order to run the following:
npm run build:dev
- running HRM version of the JSnpm run build:prod
- compile production ready code inwebroot/dist/
directory.npm run watch
- usingwatch
option of webpack to keep development version of the code inwebroot/dist
. It's useful to check how the code will look inside PHP application.npm run lint
- run ESLint checksnpm run test
- run unit tests withjest
.
Test
PHPUnit and PHP CodeSniffer
The fastest and simplest way to run PHPUnit and PHP CodeSniffer is via a composer script:
./bin/composer test
Alternatively, you can run the test with code coverage reports:
./bin/composer test-coverage
Code coverage reports in HTML format will be placed in ./build/test-coverage/
folder.
Travis CI
Continious Integration is a tool that helps to run your tests whenever you do any changes on your code base (commit, merge, etc). There are many tools that you can use, but project-template-cakephp provides an example integration with Travis CI.
Have a look at .travis.yml
file, which describes the environment matrix, project installation
steps and ways to run the test suite. For your real project, based on project-template-cakephp, you'd probably
want to remove the example tests from the file.
Examples
project-template-cakephp provides a few examples of how to write and organize unit tests. Have a look
in the tests/
folder. Now you have NO EXCUSE for not testing your applications!
Known Issues
MySQL 5.7 / MariaDB 10
Running this project template with MySQL 5.7 or MariaDB 10 sometimes causes fatal errors with SQL queries. We are looking for better ways to catch and fix those, but if you encounter them in your environment, please adjust your MySQL / MariaDB configuration for SQL mode.
SQL mode can be adjusted by either setting it in the etc/my.cnf
file like so:
[mysqld]
sql-mode="NO_ZERO_IN_DATE,NO_ZERO_DATE"
Or, alternatively, via an SQL query, like so:
mysql > SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
See this StackOverflow thread for more information.
Here are a few examples of the issues and how to fix them.
Error: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime
value: '2017-11-30T13:30:48+02:00' for column 'timestamp' at row 1
If you encounter the above error (often seen on Fedora 27 or above), make sure your SQL mode includes "NO_ZERO_IN_DATE,NO_ZERO_DATE".
Error: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of
SELECT list is not in GROUP BY clause and contains nonaggregated column ...
If you encounter the above error (often seen on Ubuntu 16.05), make sure your SQL mode DOES NOT include "ONLY_FULL_GROUP_BY".