dev-master
9999999-dev
MIT
The Requires
- php 7.1.* || 7.2.*
- composer-plugin-api ^1.1
- nemo64/environment ^1.0
The Development Requires
- composer/composer ^1.3
- phpunit/phpunit ^7.0
- mikey179/vfsstream ^1.6
This is an extension to nemo64/environment which adds a default webpack file and some configuration to the Makefile and docker configuration to easily set up a webpack in your php project., (*2)
There aren't any further local dependencies. Every node execution is run through docker., (*3)
Just run composer require --dev nemo64/webpack-environment
and the files are there.
You'll also need to implement the manifest.json
(read more) in your application., (*4)
Webpack will be executed as a docker service., (*5)
services: webpack: image: 'node:carbon' command: 'yarn run encore dev-server --host 0.0.0.0 --port 8080' ports: 8080:8080 volumes: - '.:/var/www' working_dir: /var/www
The makefile will be extended with this install job, (*6)
node_modules: docker-compose.log $(wildcard package.* yarn.*) docker-compose run --rm --no-deps webpack yarn install
If you want to experiment with webpack just use this index.php
file., (*7)
<?php $manifest = json_decode(file_get_contents(__DIR__ . '/build/manifest.json'), true); ?> <!DOCTYPE html> <html> <head> <title>Example page</title> <link rel="stylesheet" href="<?php echo htmlspecialchars($manifest['build/app.css']) ?>"> </head> <body> <div class="container"> <div class="row"> <div class="col">col1</div> <div class="col">col2</div> <div class="col">col3</div> </div> </div> <script src="<?php echo htmlspecialchars($manifest['build/app.js']) ?>"></script> </body> </html>
MIT