PHP code example of malyusha / laravel-webpack-assets
1. Go to this page and download the library: Download malyusha/laravel-webpack-assets library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
malyusha / laravel-webpack-assets example snippets
$webpackAssets = webpack();
// Full urls with hostname of filesystem. E.g. if disk driver is set to `public`, and `url` option
// is env('APP_URL').'/storage'
echo $webpackAssets->url('app.js'); // Output - http://host.dev/storage/assets/1b53147322421b069bf1.js
echo $webpackAssets->url('app.css'); // Output - http://host.dev/storage/assets/css/20a7e7e51e1f142b2b1f.css
// Absolute path for given filesystem. E.g. if disk driver is set to `public` and `root` parameter set to
// storage_path('app/public')
echo $webpackAssets->path('app.js'); // Output - /{project_dir}/storage/app/public/assets/1b53147322421b069bf1.js
// Relative paths, as they're presented inside json file
echo $webpackAssets->chunkPath('app.js'); // Output - /assets/1b53147322421b069bf1.js