Skip to content

Instantly share code, notes, and snippets.

View kklecho's full-sized avatar

Krzysztof Lechowski kklecho

  • Dublin, Ireland
View GitHub Profile
@kklecho
kklecho / git_common
Last active April 6, 2021 16:46
common git commands
git init
git add .
git commit -m "Initial commit"
# now create repo in github or elsewhere, get it's url and run below
git remote add origin <url_or_ssh>
# check
git remote -v
## no composer?
# curl -s https://getcomposer.org/installer | php
# mv composer.phar ~/bin/composer
## no symfony?
# wget https://get.symfony.com/cli/installer -O - | bash
# echo '# KL Symfony instalation' >> ~/.bashrc
# echo 'export PATH="$HOME/.symfony/bin:$PATH"' >> ~/.bashrc
# no npm? use latest lts of node, today it's 12
mkdir assets/js/components
touch assets/js/components/App.vue
php bin/console make:controller HomeController
npm run dev
sudo apt install snapd snapd-xdg-open
sudo snap install phpstorm --classic
phpstorm
import Vue from 'vue';
import App from './components/App';
new Vue({
el: '#app',
render: h => h(App)
});
#assets/js/components/App.vue
<template>
<div>
<h2 class="center">My Application</h2>
<div v-text="message"></div>
{{ message }}
<ul>
<li :key="word.id" v-for="word in words">{{ word }}</li>
</ul>
</div>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
{% endblock %}
</head>
<body>
{% extends 'base.html.twig' %}
{% block title %}Home page{% endblock %}
{% block body %}
<div ref="words" data-words="{{ words|join(',') }}">
</div>
Encore
#...
.enableVueLoader()
#...
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
/**