Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork6
Test, Run & Share Laravel Collection Examples!
License
atymic/laravel-collection-playground
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Laravel's collections are awesome!
This project provides a "jsfiddle" style environment to test, run & share collection code.
The playground usespib to evaluate PHP code directly inside the browser.
When you load the playground, Vue downloads a compiled web assembly build of PHP. This is used by they playground tolocally eval your code as you type.
The disadvantages of this approach are the limited browser support - for it to work you need to be running a desktopversion of Chrome or Firefox that is recent. Safari & Edge aren't support at the moment.Seethis issue for more information.
The playground is built as a PWA, which provides several advantages.
- Caching of downloaded PHP binary (no need to re-download the binary on each page load)
- Support for using offline (since the code is eval'd locally, it will work without any internet)
apicontains the lambda function that is used to save playground as github gists, so they can be saved & shared.php-appcontain a small PHP application that is used to evaluate the collection code, catch errors and return itback to the client as json.php-srccontains the scripts to build the in web assembly build, containing PHP + thephp-appcode.playgroundcontains the Vue application which communicates with PHP to run your code, and display the results
php php-app/create-phar.php php-src/app.phar# create the phar containing the PHP codecd php-src# Swtich to the pib dirdocker run --rm -v$(pwd):/src trzeci/emscripten:sdk-incoming-64bit bash build.sh# Build PHPcp php-7.3.6/php.wasm php-7.3.6/php.js php-7.3.6/php.data ../playground/public# Copy the compiled files into the playground
cd playgroundyarn# Install depsyarn serve# Developmentyarn build# Production build to `dist` folder
PRs are welcome! Feel free to improve the documentation, fix bugs and help make the playground better!Issues are welcome as well if you find a bug or improvement.
TheLaravel Collections documentation.
Adam Wathan has a great course,Refactoring to Collectionswhich provides tons of content on refactoring your Laravel to take advantage of collections.
The in-browser PHP evaluation usesPHP in Browser by oraoto
About
Test, Run & Share Laravel Collection Examples!
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.