4 |
5 | ### Why?
6 | Sometimes I use a random online PHP interpreter to execute a simple PHP block of code quickly.
7 | Occasionally, I wondered, "Is it really complicated to implement such an online platform? How does it work?" 🤔
8 |
9 | From that question, I tried to figure it out by implementing this fun side project.
10 |
11 | Turned out, it's not that hard. 🤓
12 |
13 | Here is how it works:
14 |
15 | - From the editor in the browser I send the code in the back-end
16 | - I create a temporary `PHP` file
17 | - I execute it with the `PHP interpreter` on the server
18 | - I return the output and show it in the browser
19 |
20 | That's literally it! 🚀
21 |
22 | ### Tech used
23 |
24 | - [TailwindCSS](https://tailwindcss.com/)
25 | - [Laravel](https://laravel.com/)
26 | - [Monaco editor](https://github.com/microsoft/monaco-editor)
27 |
28 | ### How to run
29 | This project has already `Laravel sail` installed as a dependency. So, you can easily use Docker to boot it up.
30 |
31 | You can run the following commands:
32 |
33 | - `composer install`
34 | - `./vendor/bin/sail up`
35 | - `npm run dev`
36 |
37 | By default, Laravel sail runs the project in the `80` port. So, you can access it via `http://localhost`. But you can add a separate port in `APP_PORT` in `.env` file.
38 |
39 | ### Inspiration
40 |
41 | The UI and implementation of this project is largely inspired from an excellent project called [PHPAST](https://phpast.com/) by [Ryan Chandler](https://twitter.com/ryangjchandler).
42 |
43 | ### Caution
44 | This project is intended for experiment. There might be some security issues. Because this is just executing anything is sent from the browswer.
45 |
46 | **So, DON'T RUN THIS ON YOUR PRODUCTION SERVER, unless you take necessary security measures!**
47 |
48 | ### Contribution
49 | Ideas and contributions are welcome! 🙌
50 |
--------------------------------------------------------------------------------
/resources/views/layouts/app.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Online PHP Editor - Execute PHP Code online and generate output.
9 |
10 |
11 |
12 |
13 |
14 | @vite(['resources/css/app.css', 'resources/js/app.js'])
15 |
16 |
17 |
18 |
19 |
20 |