Ready for the next step?
Use the PHP School workshop documentation to build you own workshop and help teach others PHP!
Open Menu
In this tutorial we will be building a simple workshop which is available here on GitHub as a reference, if you have any problems, you can double check your work.
In order to create a workshop the first thing you will need to do is to setup a new project and configure the dependencies and wire it all together. Luckily for you we have created a starter kit which does this all for you, prompting you along the way. Simply execute the following command in your shell.
composer create-project php-school/workshop-starter-kit <your-workshop-name>
Where <your-workshop-name>
is the name of the directory you want to setup your workshop in. For this tutorial we will create a workshop teaching some basic math concepts so we will use the name simple-math
. You will be prompted for a few things:
The name for your workshop to be put in the composer.json
file. This should follow the pattern vendor/package
. In the case of our flagship workshop Learn You PHP! this is php-school/learn-you-php
. Name your package php-school/simple-math
.
More info on the name
property can be found in the composer documentation.
A short description of your workshop which will be added to the composer.json
file. Add a short description here, something like: Learn the basics of math with PHP!
More info on the description
property can be found in the composer documentation.
The namespace which will be used in the project so it can be added to the autoload configuration in the composer.json
file. In the case of Learn You PHP! this is PhpSchool\LearnYouPhp
. We will use PhpSchool\SimpleMath
.
More info on the autoload
property can be found in the composer documentation.
This is the actual command students will execute to run your workshop. In the case of Learn You PHP! this is learnyouphp
. You should set this as simple-math
.
After you have entered the required information the workshop dependencies will be downloaded and the autoload files will be generated.
Generate the autoload information for our Namespace:
composer dump-autoload
Assuming everything went well and your are in the root of your new workshop you should be able to run the workshop!
php bin/<binary-name>
Where <binary-name>
is the name your previously entered during the create-project
command. In our case:
php bin/simple-math
If you don't see the menu above, then something went wrong. Get in touch with us and bring any helpful information such as error messages with you!