[WIP] Codeigniter 4 and Vue SPA (Vue Cli) |
A little tutorial. Work in progress.
1. Installing CodeIgniter 4 composer create-project codeigniter4/appstarter example --no-dev 2. Installing Vue in the CodeIgniter directory cd example vue create frontend --no-git 3. Move all files from example/public to example/frontend/public 4. Create a vue.config.js in the frontend directory Code: // vue.config.js - target is the url from the test server - indexPath and outputDir // after "npm run build" the build script move the example/frontend/public/index.html to example/app/Views/index.php and The example/frontend/public/ directory to the example/public directory. Warning: The npm run build delete the example/public directory and recreate it. 5. example Code. PHP Code: /** example/app/Controllers/Api/Test.php PHP Code: <?php namespace App\Controllers\Api; Catch-all Controller. PHP Code: <?php namespace App\Controllers; example/frontend/src/views/Home.vue Code: <template>
How do you set it up if you want to use vue components in several different Controller/Views ?
|
Welcome Guest, Not a member yet? Register Sign In |