When coding against CE Phoenix, I would recommend that you follow (at minimum) these guidelines:
- Phoenix core files
- The core files that are distributed with Phoenix should NOT BE CHANGED if at all possible. When I first started playing with Phoenix I started editing these files as it is the easiest way to get fast results. However, if you edit the core, all of your changes could be lost when upgrading and if everyone edited the core, we’d all have a huge mess to try and work through when adding/removing add-ons. As a result, read on and find how to add to Phoenix using the built-in methods.
- PHP
- Make sure you are using the PHP 7.3 compatible coding techniques:
- Use [] instead of array()
- Make sure do document your code well
- Use heredoc/nowdoc where possible
- Make sure you are using the PHP 7.3 compatible coding techniques:
- CSS
- You can edit the user.css file
- You can create a simple CSS hook as a safe place to put your extra CSS.
- You can add additional CSS files using hooks to inject them into different places in your pages.
- JS
- You can add additional JS files using hooks to inject them into different places in your pages.
- Naming Your Files
- Use naming conventions for your functions, variables, add-ons, hooks, etc that are specific to you as to not overlap with past/future core. I prepend all of my add-ons with “zipur” for example, “zipurUpdater”. I don’t do this because I am full of myself … I do it to avoid naming conflicts as well as making it easier to identify my modules and their origin/purpose.
- Use either underscores or camelCase:
- my_file_name.ext
- myFileName.ext