SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
#wpweekendcz | @hlavacm
#wpweekendcz | @hlavacm
#wpweekendcz | @hlavacm
Composer?
Bedrock,
aneb WordPress
přes Composer
Brilo (Team) Blog:
brilo.cz/bedrock-aneb-wordpress-pres-composer
#wpweekendcz | @hlavacm
Téma a obsah
1. Laravel framework
2. Knihovna Corcel
3. WordPress demo
#wpweekendcz | @hlavacm
1. Laravel
PHP MVC framework, který je
optimalizovaný pro reálný svět
https://laravel.com
#wpweekendcz | @hlavacm
Laravel - služby
Laravel & Lumen
Homestead & Valet
Laracasts & Laracon
Cashier & Spark
Forge & Envoyer
a další ...
#wpweekendcz | @hlavacm
Laravel 5.4 - požadavky
■ PHP >= 5.6.4
■ OpenSSL PHP Extension
■ PDO PHP Extension
■ Mbstring PHP Extension
■ Tokenizer PHP Extension
■ XML PHP Extension
#wpweekendcz | @hlavacm
Laravel - instalace
$ composer global require "laravel/installer"
$ laravel new blog
$ composer create-project --prefer-dist "laravel/laravel" blog
#wpweekendcz | @hlavacm
Laravel - konzole
$ php artisan make:controller
UserController --resource
#wpweekendcz | @hlavacm
Laravel - kód
<?php
namespace AppHttpControllers;
use AppUser;
use AppHttpControllersController;
class UserController extends Controller
{
public function show($id)
{
return view("user.profile", ["user" => User::findOrFail($id)]);
}
}
#wpweekendcz | @hlavacm
Laravel - routování
Route::get/post/put/patch/delete/options($uri, $callback);
Route::get("user/{id}", function ($id) {
return "User: $id";
});
Route::get("profile", "UserController@show")->middleware("auth");
Route::resource("users", "UserController");
#wpweekendcz | @hlavacm
Laravel - šablony
<html>
<head>
<title>App Name - @yield("title")</title>
</head>
<body>
@while (true)
<p>I"m looping forever.</p>
@endwhile
<div class="container">
@yield("content")
</div>
</body>
</html>
#wpweekendcz | @hlavacm
Laravel - Eloquent (ORM)
$users = AppUser::all();
foreach ($users as $user) {
echo $user->display_name;
}
$users = AppUser::where("user_status", 1)
->orderBy("user_registered", "desc")
->take(10)
->get();
$user = AppUser::find(1);
$user = AppUser::where("user_status", 0)->first();
#wpweekendcz | @hlavacm
2. Corcel
This package allows you to use
WordPress as backend (admin panel) and
retrieve its data using Eloquent, with any
PHP project or even framework.
https://github.com/corcel/corcel
#wpweekendcz | @hlavacm
Corcel - instalace
$ composer require jgrossi/corcel
#wpweekendcz | @hlavacm
Corcel - konfigurace
<?php // File: /config/database.php
"connections" => [
"mysql" => [ … ],
"wordpress" => [
"driver" => "mysql",
"host" => "localhost",
"database" => "corcel",
"username" => "admin",
"password" => "secret",
"charset" => "utf8",
"collation" => "utf8_unicode_ci",
"prefix" => "wp_",
"strict" => false,
"engine" => null,
],
],
#wpweekendcz | @hlavacm
Corcel - modely
<?php // File: app/Post.php
namespace App;
use CorcelPost as Corcel;
class Post extends Corcel {
protected $connection = "wordpress";
}
#wpweekendcz | @hlavacm
Corcel - volání
// using the "wordpress" connection
$posts = AppPost::all();
// using the "default" Laravel connection
$posts = CorcelPost::all();
#wpweekendcz | @hlavacm
Corcel - posty
// All published posts
$posts = Post::published()->get();
$posts = Post::status("publish")->get();
// A specific post
$post = Post::find(31);
echo $post->post_title;
// Filter by meta/custom field
$posts = Post::published()->hasMeta("field")->get();
$posts = Post::hasMeta("acf")->get();
#wpweekendcz | @hlavacm
Corcel - save
$post = new Post;
$post->save();
$post = Post::find(1);
$post->meta->username = "juniorgrossi";
$post->meta->url = "http://grossi.io";
$post->save();
#wpweekendcz | @hlavacm
Corcel - custom post type
// using type() method
$videos = Post::type("video")->status("publish")->get();
// using your own class
class Video extends CorcelPost
{
protected $postType = "video";
}
$videos = Video::status("publish")->get();
#wpweekendcz | @hlavacm
Corcel - uživatelé
// only all categories and posts connected with it
$cat = Taxonomy::where("taxonomy", "category")
->with("posts")->get();
$cat->each(function($category) {
echo $category->name;
});
// clean and simple all posts from a category
$cat = Category::slug("uncategorized")->posts()->first();
$cat->posts->each(function($post) {
echo $post->post_title;
});
#wpweekendcz | @hlavacm
Corcel - uživatelé
// All users
$users = User::get();
// A specific user
$user = User::find(1);
echo $user->user_login;
#wpweekendcz | @hlavacm
Corcel - co umí?
■ Posts
■ Advanced Custom Fields (ACF)
■ Custom Post Type
■ Shortcodes
■ Taxonomies
■ Post Format
■ Pages
■ Categories & Taxonomies
■ Attachment and Revision
■ Menu
■ Users
■ Authentication
#wpweekendcz | @hlavacm
Corcel - kdekoliv?
require __DIR__ . "/vendor/autoload.php";
$params = array(
"database" => "database_name",
"username" => "username",
"password" => "pa$$word",
"prefix" => "wp_"
);
CorcelDatabase::connect($params);
#wpweekendcz | @hlavacm
#wpweekendcz | @hlavacm
3. Demo + #kimnaslidu
#wpweekendcz | @hlavacm
Shrnutí
Laravel + Corcel = ♥
#wpweekendcz | @hlavacm
Front End
Framework Knihovna
Využití
Programátoři
Front end
Neumí vše ⚠
#wpweekendcz | @hlavacm
WP Weekend #2 - Corcel, aneb WordPress přes Laravel

Weitere ähnliche Inhalte

Was ist angesagt?

CPAN Dependency Heaven
CPAN Dependency HeavenCPAN Dependency Heaven
CPAN Dependency HeavenOpusVL
 
Laravel - Website Development in Php Framework.
Laravel - Website Development in Php Framework.Laravel - Website Development in Php Framework.
Laravel - Website Development in Php Framework.SWAAM Tech
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesdrupalindia
 
Your first sinatra app
Your first sinatra appYour first sinatra app
Your first sinatra appRubyc Slides
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Racksickill
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...Gosuke Miyashita
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsRemy Sharp
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexRyan Weaver
 
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluLaravel Poland MeetUp
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with RackDonSchado
 

Was ist angesagt? (20)

Laravel 101
Laravel 101Laravel 101
Laravel 101
 
CPAN Dependency Heaven
CPAN Dependency HeavenCPAN Dependency Heaven
CPAN Dependency Heaven
 
Intro to Laravel 4
Intro to Laravel 4Intro to Laravel 4
Intro to Laravel 4
 
Perlbal Tutorial
Perlbal TutorialPerlbal Tutorial
Perlbal Tutorial
 
Laravel - Website Development in Php Framework.
Laravel - Website Development in Php Framework.Laravel - Website Development in Php Framework.
Laravel - Website Development in Php Framework.
 
Migraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sitesMigraine Drupal - syncing your staging and live sites
Migraine Drupal - syncing your staging and live sites
 
Your first sinatra app
Your first sinatra appYour first sinatra app
Your first sinatra app
 
Building web framework with Rack
Building web framework with RackBuilding web framework with Rack
Building web framework with Rack
 
How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...How Danga::Socket handles asynchronous processing and how to write asynchrono...
How Danga::Socket handles asynchronous processing and how to write asynchrono...
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
appache_1
appache_1appache_1
appache_1
 
HTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & socketsHTML5 tutorial: canvas, offfline & sockets
HTML5 tutorial: canvas, offfline & sockets
 
Mojolicious
MojoliciousMojolicious
Mojolicious
 
Master the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and SilexMaster the New Core of Drupal 8 Now: with Symfony and Silex
Master the New Core of Drupal 8 Now: with Symfony and Silex
 
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
Ruby MVC from scratch with Rack
Ruby MVC from scratch with RackRuby MVC from scratch with Rack
Ruby MVC from scratch with Rack
 
Tatsumaki
TatsumakiTatsumaki
Tatsumaki
 
Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
Flask
FlaskFlask
Flask
 

Ähnlich wie WP Weekend #2 - Corcel, aneb WordPress přes Laravel

Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5Bukhori Aqid
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Dilouar Hossain
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment Evaldo Felipe
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroChristopher Pecoraro
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentationToufiq Mahmud
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressJeroen van Dijk
 
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)James Titcumb
 
From CakePHP to Laravel
From CakePHP to LaravelFrom CakePHP to Laravel
From CakePHP to LaravelJason McCreary
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentTammy Hart
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Jeff Jones
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stackPaul Bearne
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Lorvent56
 

Ähnlich wie WP Weekend #2 - Corcel, aneb WordPress přes Laravel (20)

Getting to know Laravel 5
Getting to know Laravel 5Getting to know Laravel 5
Getting to know Laravel 5
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher Pecoraro
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
New PHP Exploitation Techniques
New PHP Exploitation TechniquesNew PHP Exploitation Techniques
New PHP Exploitation Techniques
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
 
6. Add numbers in Laravel
6. Add numbers in Laravel6. Add numbers in Laravel
6. Add numbers in Laravel
 
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
Kicking off with Zend Expressive and Doctrine ORM (PHPNW2016)
 
From CakePHP to Laravel
From CakePHP to LaravelFrom CakePHP to Laravel
From CakePHP to Laravel
 
Pecl Picks
Pecl PicksPecl Picks
Pecl Picks
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
WCLA12 JavaScript
WCLA12 JavaScriptWCLA12 JavaScript
WCLA12 JavaScript
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
 
Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!Apache and PHP: Why httpd.conf is your new BFF!
Apache and PHP: Why httpd.conf is your new BFF!
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stack
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
 
Os Treat
Os TreatOs Treat
Os Treat
 

Mehr von Brilo Team

PHP Vysočina - WordPress - 25.10.2018
PHP Vysočina - WordPress - 25.10.2018PHP Vysočina - WordPress - 25.10.2018
PHP Vysočina - WordPress - 25.10.2018Brilo Team
 
Nástroj Calfou.cz - WP Weekend #3
Nástroj Calfou.cz - WP Weekend #3Nástroj Calfou.cz - WP Weekend #3
Nástroj Calfou.cz - WP Weekend #3Brilo Team
 
WPML - jak na vícejazyčný web - WP Weekend #3
WPML - jak na vícejazyčný web - WP Weekend #3WPML - jak na vícejazyčný web - WP Weekend #3
WPML - jak na vícejazyčný web - WP Weekend #3Brilo Team
 
HTML stack pro WP šablonu - WP Weekend #3
HTML stack pro WP šablonu - WP Weekend #3HTML stack pro WP šablonu - WP Weekend #3
HTML stack pro WP šablonu - WP Weekend #3Brilo Team
 
WordPress "root" skripty - WP Weekend #3
WordPress "root" skripty - WP Weekend #3 WordPress "root" skripty - WP Weekend #3
WordPress "root" skripty - WP Weekend #3 Brilo Team
 
PoSobota 96 ČB 28.4.2018
PoSobota 96 ČB 28.4.2018PoSobota 96 ČB 28.4.2018
PoSobota 96 ČB 28.4.2018Brilo Team
 
WP Frameworky - WordCamp Praha 2018
WP Frameworky - WordCamp Praha 2018WP Frameworky - WordCamp Praha 2018
WP Frameworky - WordCamp Praha 2018Brilo Team
 
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17Brilo Team
 
WordCamp Bratislava 2017 - Martin Hlaváč
WordCamp Bratislava 2017 - Martin HlaváčWordCamp Bratislava 2017 - Martin Hlaváč
WordCamp Bratislava 2017 - Martin HlaváčBrilo Team
 
WordCamp Bratislava 2017 - Jakub Hladký
WordCamp Bratislava 2017 - Jakub HladkýWordCamp Bratislava 2017 - Jakub Hladký
WordCamp Bratislava 2017 - Jakub HladkýBrilo Team
 
Pux 28.2.2017 Úvod do internetového marketingu
Pux 28.2.2017 Úvod do internetového marketinguPux 28.2.2017 Úvod do internetového marketingu
Pux 28.2.2017 Úvod do internetového marketinguBrilo Team
 
WordCamp Praha 2017 - Tomáš Kocifaj
WordCamp Praha 2017 - Tomáš KocifajWordCamp Praha 2017 - Tomáš Kocifaj
WordCamp Praha 2017 - Tomáš KocifajBrilo Team
 
WordCamp Praha 2017 - Martin Hlaváč
WordCamp Praha 2017 - Martin HlaváčWordCamp Praha 2017 - Martin Hlaváč
WordCamp Praha 2017 - Martin HlaváčBrilo Team
 
Jihočeské vzdělávání dospělých - SEO část
Jihočeské vzdělávání dospělých - SEO částJihočeské vzdělávání dospělých - SEO část
Jihočeské vzdělávání dospělých - SEO částBrilo Team
 
Jihočeské vzdělávání dospělých
Jihočeské vzdělávání dospělýchJihočeské vzdělávání dospělých
Jihočeské vzdělávání dospělýchBrilo Team
 
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016Brilo Team
 
Základy Sociálních médií - WP Konference 2016 Praha
Základy Sociálních médií - WP Konference 2016 PrahaZáklady Sociálních médií - WP Konference 2016 Praha
Základy Sociálních médií - WP Konference 2016 PrahaBrilo Team
 
Základy Marketingu - WP Konference 2016 Praha
Základy Marketingu - WP Konference 2016 PrahaZáklady Marketingu - WP Konference 2016 Praha
Základy Marketingu - WP Konference 2016 PrahaBrilo Team
 
Plánování webu - WP Konference 2016 Praha
Plánování webu - WP Konference 2016 PrahaPlánování webu - WP Konference 2016 Praha
Plánování webu - WP Konference 2016 PrahaBrilo Team
 
Brilo team zaklady SEO WPkonference 25.6.2016
Brilo team zaklady SEO WPkonference 25.6.2016Brilo team zaklady SEO WPkonference 25.6.2016
Brilo team zaklady SEO WPkonference 25.6.2016Brilo Team
 

Mehr von Brilo Team (20)

PHP Vysočina - WordPress - 25.10.2018
PHP Vysočina - WordPress - 25.10.2018PHP Vysočina - WordPress - 25.10.2018
PHP Vysočina - WordPress - 25.10.2018
 
Nástroj Calfou.cz - WP Weekend #3
Nástroj Calfou.cz - WP Weekend #3Nástroj Calfou.cz - WP Weekend #3
Nástroj Calfou.cz - WP Weekend #3
 
WPML - jak na vícejazyčný web - WP Weekend #3
WPML - jak na vícejazyčný web - WP Weekend #3WPML - jak na vícejazyčný web - WP Weekend #3
WPML - jak na vícejazyčný web - WP Weekend #3
 
HTML stack pro WP šablonu - WP Weekend #3
HTML stack pro WP šablonu - WP Weekend #3HTML stack pro WP šablonu - WP Weekend #3
HTML stack pro WP šablonu - WP Weekend #3
 
WordPress "root" skripty - WP Weekend #3
WordPress "root" skripty - WP Weekend #3 WordPress "root" skripty - WP Weekend #3
WordPress "root" skripty - WP Weekend #3
 
PoSobota 96 ČB 28.4.2018
PoSobota 96 ČB 28.4.2018PoSobota 96 ČB 28.4.2018
PoSobota 96 ČB 28.4.2018
 
WP Frameworky - WordCamp Praha 2018
WP Frameworky - WordCamp Praha 2018WP Frameworky - WordCamp Praha 2018
WP Frameworky - WordCamp Praha 2018
 
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17
Jak spolehlivě potopit web nebo e-shop | Pux 1.11.17
 
WordCamp Bratislava 2017 - Martin Hlaváč
WordCamp Bratislava 2017 - Martin HlaváčWordCamp Bratislava 2017 - Martin Hlaváč
WordCamp Bratislava 2017 - Martin Hlaváč
 
WordCamp Bratislava 2017 - Jakub Hladký
WordCamp Bratislava 2017 - Jakub HladkýWordCamp Bratislava 2017 - Jakub Hladký
WordCamp Bratislava 2017 - Jakub Hladký
 
Pux 28.2.2017 Úvod do internetového marketingu
Pux 28.2.2017 Úvod do internetového marketinguPux 28.2.2017 Úvod do internetového marketingu
Pux 28.2.2017 Úvod do internetového marketingu
 
WordCamp Praha 2017 - Tomáš Kocifaj
WordCamp Praha 2017 - Tomáš KocifajWordCamp Praha 2017 - Tomáš Kocifaj
WordCamp Praha 2017 - Tomáš Kocifaj
 
WordCamp Praha 2017 - Martin Hlaváč
WordCamp Praha 2017 - Martin HlaváčWordCamp Praha 2017 - Martin Hlaváč
WordCamp Praha 2017 - Martin Hlaváč
 
Jihočeské vzdělávání dospělých - SEO část
Jihočeské vzdělávání dospělých - SEO částJihočeské vzdělávání dospělých - SEO část
Jihočeské vzdělávání dospělých - SEO část
 
Jihočeské vzdělávání dospělých
Jihočeské vzdělávání dospělýchJihočeské vzdělávání dospělých
Jihočeské vzdělávání dospělých
 
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016
Chytrá propagace e-shopu pomocí témat - Eshopvíkend 2016
 
Základy Sociálních médií - WP Konference 2016 Praha
Základy Sociálních médií - WP Konference 2016 PrahaZáklady Sociálních médií - WP Konference 2016 Praha
Základy Sociálních médií - WP Konference 2016 Praha
 
Základy Marketingu - WP Konference 2016 Praha
Základy Marketingu - WP Konference 2016 PrahaZáklady Marketingu - WP Konference 2016 Praha
Základy Marketingu - WP Konference 2016 Praha
 
Plánování webu - WP Konference 2016 Praha
Plánování webu - WP Konference 2016 PrahaPlánování webu - WP Konference 2016 Praha
Plánování webu - WP Konference 2016 Praha
 
Brilo team zaklady SEO WPkonference 25.6.2016
Brilo team zaklady SEO WPkonference 25.6.2016Brilo team zaklady SEO WPkonference 25.6.2016
Brilo team zaklady SEO WPkonference 25.6.2016
 

Kürzlich hochgeladen

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 

Kürzlich hochgeladen (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

WP Weekend #2 - Corcel, aneb WordPress přes Laravel

  • 1.
  • 5. Composer? Bedrock, aneb WordPress přes Composer Brilo (Team) Blog: brilo.cz/bedrock-aneb-wordpress-pres-composer #wpweekendcz | @hlavacm
  • 6. Téma a obsah 1. Laravel framework 2. Knihovna Corcel 3. WordPress demo #wpweekendcz | @hlavacm
  • 7. 1. Laravel PHP MVC framework, který je optimalizovaný pro reálný svět https://laravel.com #wpweekendcz | @hlavacm
  • 8. Laravel - služby Laravel & Lumen Homestead & Valet Laracasts & Laracon Cashier & Spark Forge & Envoyer a další ... #wpweekendcz | @hlavacm
  • 9. Laravel 5.4 - požadavky ■ PHP >= 5.6.4 ■ OpenSSL PHP Extension ■ PDO PHP Extension ■ Mbstring PHP Extension ■ Tokenizer PHP Extension ■ XML PHP Extension #wpweekendcz | @hlavacm
  • 10. Laravel - instalace $ composer global require "laravel/installer" $ laravel new blog $ composer create-project --prefer-dist "laravel/laravel" blog #wpweekendcz | @hlavacm
  • 11. Laravel - konzole $ php artisan make:controller UserController --resource #wpweekendcz | @hlavacm
  • 12. Laravel - kód <?php namespace AppHttpControllers; use AppUser; use AppHttpControllersController; class UserController extends Controller { public function show($id) { return view("user.profile", ["user" => User::findOrFail($id)]); } } #wpweekendcz | @hlavacm
  • 13. Laravel - routování Route::get/post/put/patch/delete/options($uri, $callback); Route::get("user/{id}", function ($id) { return "User: $id"; }); Route::get("profile", "UserController@show")->middleware("auth"); Route::resource("users", "UserController"); #wpweekendcz | @hlavacm
  • 14. Laravel - šablony <html> <head> <title>App Name - @yield("title")</title> </head> <body> @while (true) <p>I"m looping forever.</p> @endwhile <div class="container"> @yield("content") </div> </body> </html> #wpweekendcz | @hlavacm
  • 15. Laravel - Eloquent (ORM) $users = AppUser::all(); foreach ($users as $user) { echo $user->display_name; } $users = AppUser::where("user_status", 1) ->orderBy("user_registered", "desc") ->take(10) ->get(); $user = AppUser::find(1); $user = AppUser::where("user_status", 0)->first(); #wpweekendcz | @hlavacm
  • 16. 2. Corcel This package allows you to use WordPress as backend (admin panel) and retrieve its data using Eloquent, with any PHP project or even framework. https://github.com/corcel/corcel #wpweekendcz | @hlavacm
  • 17. Corcel - instalace $ composer require jgrossi/corcel #wpweekendcz | @hlavacm
  • 18. Corcel - konfigurace <?php // File: /config/database.php "connections" => [ "mysql" => [ … ], "wordpress" => [ "driver" => "mysql", "host" => "localhost", "database" => "corcel", "username" => "admin", "password" => "secret", "charset" => "utf8", "collation" => "utf8_unicode_ci", "prefix" => "wp_", "strict" => false, "engine" => null, ], ], #wpweekendcz | @hlavacm
  • 19. Corcel - modely <?php // File: app/Post.php namespace App; use CorcelPost as Corcel; class Post extends Corcel { protected $connection = "wordpress"; } #wpweekendcz | @hlavacm
  • 20. Corcel - volání // using the "wordpress" connection $posts = AppPost::all(); // using the "default" Laravel connection $posts = CorcelPost::all(); #wpweekendcz | @hlavacm
  • 21. Corcel - posty // All published posts $posts = Post::published()->get(); $posts = Post::status("publish")->get(); // A specific post $post = Post::find(31); echo $post->post_title; // Filter by meta/custom field $posts = Post::published()->hasMeta("field")->get(); $posts = Post::hasMeta("acf")->get(); #wpweekendcz | @hlavacm
  • 22. Corcel - save $post = new Post; $post->save(); $post = Post::find(1); $post->meta->username = "juniorgrossi"; $post->meta->url = "http://grossi.io"; $post->save(); #wpweekendcz | @hlavacm
  • 23. Corcel - custom post type // using type() method $videos = Post::type("video")->status("publish")->get(); // using your own class class Video extends CorcelPost { protected $postType = "video"; } $videos = Video::status("publish")->get(); #wpweekendcz | @hlavacm
  • 24. Corcel - uživatelé // only all categories and posts connected with it $cat = Taxonomy::where("taxonomy", "category") ->with("posts")->get(); $cat->each(function($category) { echo $category->name; }); // clean and simple all posts from a category $cat = Category::slug("uncategorized")->posts()->first(); $cat->posts->each(function($post) { echo $post->post_title; }); #wpweekendcz | @hlavacm
  • 25. Corcel - uživatelé // All users $users = User::get(); // A specific user $user = User::find(1); echo $user->user_login; #wpweekendcz | @hlavacm
  • 26. Corcel - co umí? ■ Posts ■ Advanced Custom Fields (ACF) ■ Custom Post Type ■ Shortcodes ■ Taxonomies ■ Post Format ■ Pages ■ Categories & Taxonomies ■ Attachment and Revision ■ Menu ■ Users ■ Authentication #wpweekendcz | @hlavacm
  • 27. Corcel - kdekoliv? require __DIR__ . "/vendor/autoload.php"; $params = array( "database" => "database_name", "username" => "username", "password" => "pa$$word", "prefix" => "wp_" ); CorcelDatabase::connect($params); #wpweekendcz | @hlavacm
  • 29. 3. Demo + #kimnaslidu #wpweekendcz | @hlavacm
  • 30. Shrnutí Laravel + Corcel = ♥ #wpweekendcz | @hlavacm Front End Framework Knihovna
  • 31. Využití Programátoři Front end Neumí vše ⚠ #wpweekendcz | @hlavacm