In this repository is a generic calculator that uses the Twig expression engine to perform calculations. We would like for you to improve it in your own way, so it could be used by a customer to perform test calculations using their own expressions.
This test is based on a production-deployed solution that our customers use daily: the AlisQI Expression Engine
Included is a simple calculator.php script, which sets up the Twig environment and runs a few example calculations.
Using your best judgement, reimplement this functionality to:
- Allow a user to input their own expressions and values in a frontend
- Adopt OOP principles (either a framework or your own implementation)
- Perform unit testing
See the AlisQI Stack for what we use.
- Consider what happens if a user inputs invalid values
- Complex queries, how they may affect the backend application
- Could results be saved or cached in any way?
- Security considerations -- what are the risks and how can you mitigate them?
We are interested in your approach and considerations, rather than the perfect solution. Please try to not spend more than a couple of hours on the assessment ;)
How you build your solution is entirely up to you! For reference, here is our stack:
Create a private repository, and invite @chemicalstrawberry as a read-only participant.
Zip/Tarball your project folder (don't forget to include your .git folder!), and email it to [email protected].