- Install PHP, optionally with MySQL/Apache:
- Install Composer -- https://getcomposer.org/
- Choose an example problem from the below list you want to work on.
- Use libraries you've never used before!
- Regroup at the end to discuss what you tried and learned.
Learn to use objects and namespaces
- Invoke your program from the command-line.
- Implement the FizzBuzz kata.
- Use objects to model your code.
- Make all classes use namespaces.
Do it with functions
- Invoke your program from the command-line.
- Implement the FizzBuzz kata using anonymous functions or closures.
Requirements
- Model an ice cream store that's giving away free ice cream for their grand opening
- List the available flavors
- Alphabetical order
- Customer can place a new order
- Size, flavor, customer name
- After placing their order the Customer should receive an order number that will be called later
- Allow a customer to inquire about their order
- Return their order number, size, flavor, customer name and status
- Allow a customer to cancel their order
- Customer will give you their order number to cancel
Create a RESTful API for the requirements above using a micro framework
Create a command-line program for the requirements above
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"
FizzBuzz: Explore testing using PHPUnit
- Implement the FizzBuzz kata.
- Write tests for your solution to verify it meets the requirements.
- Try kickstarting your project using this skeleton: https://github.com/kcphpug/tdd-kata-template
FizzBuzz: Explore testing using PHPSpec
- Implement the FizzBuzz kata.
- Write tests for your solution to verify it meets the requirements.
- Try kickstarting your project using this skeleton: https://github.com/kcphpug/tdd-kata-template
FizzBuzz: Hard mode
- Pretend the following PHP keywords do not exist. Implement FizzBuzz.
- if/else
- for
- foreach
- do/while
- Ask John if you need hints :)
Write a program using an event loop that simulates processing ice cream orders
Ice cream stand requirements:
- Create an ice cream stand and staff it with 3 workers
- Ability to add more workers while the store is open
- Take in some new ice cream orders and fulfill them
- Worker details
- Preparing each flavor takes a variable time to prepare: number of letters in flavor name * 10 seconds. (i.e. chocolate === 90 seconds)
- Ascribe certain workers with knowledge to only prepare certain flavors
- Gracefully handle when a customer orders a flavor you don't have
- Elastic features
- How many orders per minute can you fulfill?
- Can you add logic to intelligently call in new workers or prune workers according to work load?
Libraries for event loop in PHP:
- reactphp -- http://reactphp.org/
- reactphp/socket
- reactphp/socket-client
- reactphp/stream
- reactphp/event-loop
- Start here for inspiration: https://github.com/reactphp/socket