Skip to content

New Pull Request

A pull request for Phalcon should target the correct repository in the Phalcon organization. The C extension (Phalcon v5) lives in cphalcon; the PHP implementation (Phalcon v6) lives in phalcon/phalcon. The sample applications, tooling, and documentation each have their own repository. This page uses cphalcon for its examples, but the same process applies to any of them. A pull request is a collection of changes to the code that:

  • fix a bug (current issue)
  • introduce new functionality or enhancement.

Your pull request must include:

  • Target the correct branch.
  • Update the relevant CHANGELOG.md
  • Contain unit tests
  • Updates to the documentation and usage examples as necessary
  • Your code must abide by the coding standards that Phalcon uses. For PHP code we use PSR-12 while for Zephir code, we have a .editorconfig file available at the root of the repository to help you follow the standards.

If your pull request relates to fixing an issue/bug, please link the issue number in the pull request body. You can utilize the template we have in GitHub to present this information. If no issue exists, please create one.

For new functionality, we will need to have an issue created and referenced. If the functionality you are introducing collides with the philosophy and implementation of Phalcon, the pull request will be rejected.

Additionally, any new functionality that introduces breaking changes will not be accepted for the current release but instead will need to be updated to target the next major version.

It is highly recommended to discuss your NFR and PR with the core team and most importantly with the community to get feedback, and guidance and to work on a release plan that will benefit everyone.

Branch and Commits

The following steps are recommended but not mandatory.

If you are working on an issue, note the number of the issue down. Let us assume that the issue is:

#12345 - Create New Object

  • Check out the development branch: 5.0.x for cphalcon, v6.0.x for phalcon/phalcon
  • Create a branch: CP-12345-create-new-object for cphalcon, T12345-create-new-object for phalcon/phalcon

The name of the branch starts with a prefix (CP- or T), followed by the number of the issue and then the title of the issue as a slug.

In the folder of your clone, navigate to .git/hooks

Create a new file called commit-msg paste the code below in it and save it:

#!/bin/bash
BRANCH_NAME=$(git symbolic-ref --short HEAD 2>/dev/null)
BRANCH_NAME="${BRANCH_NAME##*/}"
if [[ $BRANCH_NAME =~ ^[A-Za-z]+-?([0-9]+)- ]]; then
  ISSUE="#${BASH_REMATCH[1]}"
  if ! grep -q "^\[$ISSUE\]" "$1"; then
    sed -i.bak -e "1s/^/[$ISSUE] - /" "$1"
  fi
fi

Ensure that the file is executable

chmod a+x commit-msg

Any commits you add now to your branch will appear tied to the 12345 issue. The hook adds the issue number to the start of the commit message:

git commit -m "adding the new object"
[#12345] - adding the new object

The hook does not add the issue number when the message already starts with it, for example when you use git commit --amend. On a branch without an issue number, such as 5.0.x, the hook does not change the message.

Doing the above allows everyone to see which commits relate to which issue.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close