Contribute a PHP Example
Pick a good first issue or improve an example in a lesson you’ve tried.
- Find the files. Use the lesson’s Edit page link to find its Markdown under
src/content/docs/. Follow the lesson’s repository link to its examples. Keep a new file alongside the existing examples undercode/<series>/, or follow the lesson’s existing arrangement. - Make one small change. Add a complete example with sample input, a command readers can copy, and the expected output. Use fictional input and the PHP version and extensions listed in the lesson. For alternate solutions, show how to run each one and when you’d choose it.
- Run the code. From the repository root, use
php -l path/to/example.phpto check syntax, then run the same command you put in the lesson. Include any setup steps, input files, and command output in your pull request. - Check the page. Run
npm ci,npm run build, andnpm run check:seofrom the repository root. Open the lesson in the preview withnpm run previewif you changed how an example is displayed. - Open a pull request. Link to the lesson and explain what a reader can now do. Include the name you would like us to use if we thank you in the site updates.
Use Report a problem with this example at the end of a chapter to report a broken command. Ask a question in GitHub Discussions if you’re stuck, or suggest what we should explain next.