Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

This repository has been archived. The new URL is https://github.com/macareuxdigital/coding-standards. Please do not create new issues or pull requests in this repository.

Notifications You must be signed in to change notification settings

concrete5cojp/c5j-coding-standards

Repository files navigation

C5J Coding Standards

Clean Code Concepts for PHP

I think this is a matter of personal taste. When is the code clean? When is it not? This is hard to say, but there are some general guidelines which you can follow to help improve your code. Below I have given the references that I use, and they have helped me so far.

Follow the concrete5 official documentation.

Clean Code PHP(jupeter/clean-code-php), is a guide based on the book Clean Code: A Handbook of Agile Software Craftmanship, a classic programming book about writing maintainable code by Uncle Bob Martin. I recommend this as a Must Read guideline.

Check their official documentation to integrate with your IDE. Also, concrete5 has a command (from 8.5.3) to use it. Please run ./concrete/bin/concrete5 c5:phpcs --help for detail.

👉Tips & Tricks

Package development

The followings are the basic requirements when you make a package-

👉Config

  • Contents (Block Types, Single Pages, Express Objects etc.) can be installed Programmatically or using CIF files. CIF is the recommended way to use.
  • Add an example config file (if any). e.g., example.concrete.php

👉Routes

  • Follow the official guide to send data to and from a controller into the page view. Please avoid using ajax unnecessarily.

I've created this skeleton package as a starting point to develop packages. You can get ideas from here. Feel free to make a pull request to improve this repository.

Performance

  • Avoid duplicate MySQL queries.
  • Use Object Caching to improve performance.

Test

  • Write PHPUnit tests to test your package.

Documentation

About

This repository has been archived. The new URL is https://github.com/macareuxdigital/coding-standards. Please do not create new issues or pull requests in this repository.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages