Source code for L'Eco-Mémo, the memory game of Eco-Actitude: find the 9 pairs of zero-waste products and learn an eco-friendly fact with each match.
The whole game runs in a single Livewire component (MemoryGame) with its state persisted in the session, so a game in progress survives a page reload.
18 cards (9 pairs), shuffled at every new game:
![]() |
![]() |
|---|---|
| 🟢 The two cards match: they stay face up and you score 10 + combo × 5 points. | 🔴 The two cards differ: they turn red, flip back after 800 ms, the attempt counter increases and you lose points. |
- A combo is the number of pairs found in a row; it resets on every miss.
- Each matched pair scores
10 + combo × 5points (15 for the first match, 20 for the second in a row, 25 for the third…). - Each miss costs 1 point when the score is below 10, otherwise 10% of the score.
Chain pairs without missing and a combo badge pops on the board while the bonus grows:
Every matched pair reveals an eco-fact about the product (recycled paper, solid soap, dishwasher tablets…), displayed under the board.
Once all pairs are found, you can save your score (name validation + rate limiting: 3 saves per minute per IP) and see the top 15 on the high-scores page.
cd project
composer installCopy .env.example to .env in the project/ directory (local defaults use SQLite and file-based cache/sessions), then generate the app key:
cp .env.example .env
php artisan key:generatephp artisan migrate
php artisan db:seedThe seeder inserts the 9 card pairs on first run and refreshes their captions and eco-facts on subsequent runs, so it is safe to re-run after a deploy.
Assets are compiled with Laravel Mix (SCSS + JS, minified to public/css/app.min.css and public/js/app.min.js):
npm install
npm run development # dev build
npm run production # minified build
npm run start # watch modeThe feature test suite covers the whole game loop (matching, mismatching, combos, eco-facts, end of game, score saving and validation) against an in-memory SQLite database:
./vendor/bin/phpunitscripts/refresh_cache.sh— clears and rebuilds the config/route caches, and resets OPcache outside the local environment.scripts/build_ftp_package.sh— builds a self-contained FTP deployment bundle (deploy-ftp/) for shared hosting without SSH access: production assets, zipped vendor directory, one-shot extraction/migration scripts and step-by-step instructions.





