gibamaranhao / vue-component
A Simple Vue Component loader for PHP
Installs: 11
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/gibamaranhao/vue-component
Requires
- php: >=5.6|>=7.0
This package is auto-updated.
Last update: 2025-12-15 06:29:02 UTC
README
A Simple Vue Component loader for PHP
vue-component allows you to create single-file style codes and generate component code to be added to HTML without the need to work with webpack, vue-cli or npm.
Installation
The recomended way to install is via composer
composer.json
{
"minimum-stability" : "dev",
"require" : {
"gibamaranhao/vue-component" : "*"
}
}
Execute composer update to install
Usage
Create a component folder and a component file (the extension can be .vue, .js, .php, .html ,no matters):
components/App.vue
<template> <h1 class="redone"> Hello, VueComponent </h1> </template> <script> Vue.component('App',{}) </script> <style> .redone { color: red; } </style>
<?php use gibamaranhao\vue\VueComponent; $loader = require_once __DIR__.'/vendor/autoload.php'; $vc = new VueComponent(); $vc->registerComponentsFromDir(__DIR__.'/components'); ?> <html> <head> <title> GibaMaranhao - VueComponent </title> </head> <body> <div id="app"> <App /> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.21/vue.min.js"></script> <?= $vc->renderAllComponents() ?> <script> new Vue({ el: '#app' }); </script> </body> </html>