<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Triggerdesign &#187; Tutorial</title>
	<atom:link href="https://triggerdesign.de/category/coding/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>https://triggerdesign.de</link>
	<description>Web development</description>
	<lastBuildDate>Thu, 22 Oct 2015 09:37:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.39</generator>
	<item>
		<title>Our first Laravel application</title>
		<link>https://triggerdesign.de/our-first-laravel-application/</link>
		<comments>https://triggerdesign.de/our-first-laravel-application/#comments</comments>
		<pubDate>Wed, 29 Oct 2014 08:33:23 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://triggerdesign.de/?p=199</guid>
		<description><![CDATA[Now it’s time to play with all your imaginations. With Laravel on your server, it is possible to create any web application you want – but for now we will make a good old blogging tool. Connect your database Laravel supports nearly every DBMS, but we will use MySQL to save our blog posts persistently. [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Now it’s time to play with all your imaginations. With Laravel on your server, it is possible to create any web application you want – but for now we will make a good old blogging tool.</p>
<h3>Connect your database</h3>
<p>Laravel supports nearly every DBMS, but we will use MySQL to save our blog posts persistently. Go into<strong> app\config\database.php</strong> and tell the framework your database credentials by changing the already existing array called <strong>mysql</strong>:</p><pre class="crayon-plain-tag">'mysql' =&gt; array(
	'driver'    =&gt; 'mysql',
	'host'      =&gt; 'localhost',
	'database'  =&gt; 'DATABASE NAME',
	'username'  =&gt; 'USERNAME HERE',
	'password'  =&gt; 'PASSWORD',
	'charset'   =&gt; 'utf8',
	'collation' =&gt; 'utf8_unicode_ci',
	'prefix'    =&gt; '',
),</pre><p>&nbsp;</p>
<div class="blog-infofield">
<p>Note: For this example you should use an IDE that supports FTP connections. <a href="https://www.youtube.com/watch?v=AHK20LWEWXQ">PhpStorm </a>and <a href="http://www.patrickjwaters.com/blog/2011-07-24/how-setup-eclipse-php-pdt-remote-system-explorer-theme-manager-and-drupal-plugins/35">Eclipse</a> can automatically deploy the PHP files onto your server after every change you make.</p>
</div>
<h3>Use composer to install free code packages</h3>
<p>The package manager tool composer will help use once again. We will use the a <a href="https://github.com/JeffreyWay/Laravel-4-Generators">generator written by Jeffrey Way</a> to auto generate all the basic files we need for a resources like post entries or  comments.</p>
<p>Go to your root folder an open the<strong> composer.json </strong>file, you will have to add the <strong>&#8220;require-dev&#8221; </strong>array:</p><pre class="crayon-plain-tag">{
...
	"require": {
		"laravel/framework": "4.2.*"
	},
    "require-dev": {
        "way/generators": "~2.0"
    },
...
}</pre><p>Next step is to go to your ssh-console again and run the following command in the &#8220;<strong>superblog</strong>&#8221; folder (the root folder of your application):</p><pre class="crayon-plain-tag">composer update --dev</pre><p>The command above downloaded the generator package into your &#8220;superblog/vendor&#8221; folder, now you have to tell Laravel that it should use this package by going into &#8220;<strong>app/config/app.php</strong>&#8221; (the main config file of your application):</p><pre class="crayon-plain-tag">'providers' =&gt; array(
		/*...*/
		'Illuminate\View\ViewServiceProvider',
		'Illuminate\Workbench\WorkbenchServiceProvider',
		'Way\Generators\GeneratorsServiceProvider'
	),</pre><p></p>
<h3> Scaffold your blog</h3>
<p>We will now use the generator to scaffold our first resource: the posts.<br />
The generator will generate the controller the folliwing things for us:</p>
<ul>
<li>The controller in which we can handle actions like list, show, edit and delete.</li>
<li>The model in which we can define the relationships and special functions like getters and setters.</li>
<li>Files for the view</li>
<li>A migration file for the creation of a fitting database table.</li>
</ul>
<p>All you need for this is just one line of code! So go into your ssh and type in:</p><pre class="crayon-plain-tag">php artisan generate:resource post --fields="title:string, content:text"
#Accept every question that follows with an Y (for yes)</pre><p>In the end the generator will output the following sentence: <b>All done! Don&#8217;t forget to add &#8220;Route::resource(&#8216;posts&#8217;, &#8216;PostsController&#8217;);&#8221; to app/routes.php. </b>If you follow this suggestion you can already call the following URLs:</p>
<ul>
<li>domain.com/posts (for a list of all posts)</li>
<li>domain.com/posts/create (will show a form for the creation of a post)</li>
<li>domain.com/posts/1 (will show details about a not existing blog with an id that equals 1)</li>
<li>domain.com/posts/1/edit (will show a form for updating a post)</li>
</ul>
<p>Now we will do the same for the Comments:</p><pre class="crayon-plain-tag">php artisan generate:resource comment --fields="email: string, title:string, content:text, post_id:integer"  

#Accept every question that follows with an Y (for yes)</pre><p>After generating the post files go to &#8220;<strong>app/routes.php</strong>&#8221; and add <strong>Route::resource(&#8216;comments&#8217;, &#8216;CommentsController&#8217;); </strong>below the route for the posts.</p>
<div class="blog-infofield">
<p>You can step over the points below if you just scroll down, click download and copy the contentsof the github repository over the folder of your app.</p>
<p>&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>https://triggerdesign.de/our-first-laravel-application/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with Laravel</title>
		<link>https://triggerdesign.de/getting-started-with-laravel/</link>
		<comments>https://triggerdesign.de/getting-started-with-laravel/#comments</comments>
		<pubDate>Mon, 27 Oct 2014 19:26:42 +0000</pubDate>
		<dc:creator><![CDATA[Simon]]></dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://triggerdesign.de/?p=174</guid>
		<description><![CDATA[What will be covered In this ePaper you will learn how to work with the MVC-Framework Laravel. You will experience the development of a running blog-application, that is easy to expand with free code packages, maintainable and fun to code. The presentation and this ePaper cover the following points: Prepare your webserver for the Framework [&#8230;]]]></description>
				<content:encoded><![CDATA[<h3><span style="font-size: 1.17em;">What will be covered</span></h3>
<p>In this ePaper you will learn how to work with the MVC-Framework Laravel. You will experience the development of a running blog-application, that is easy to expand with free code packages, maintainable and fun to code.</p>
<p><span id="more-174"></span></p>
<p>The presentation and this ePaper cover the following points:</p>
<ol>
<li>Prepare your webserver for the Framework</li>
<li>How to install composer</li>
<li>How install and configure Laravel</li>
<li>Bringing free pre-coded composer packages into your application</li>
<li>Scaffold a blogging tool using a generator</li>
<li>How you can use one line of code to make your Website accessible via REST</li>
<li>Forget never-ending HTML and PHP combinations – write your templates in Blade</li>
</ol>
<h3>The Result</h3>
<p>You can see the result here: <a href="http://epaper2.brainlovers.com/posts">http://epaper2.brainlovers.com/posts</a></p>
<p>If something does not work the way it should you can always take a look at this repository:<a href="https://github.com/triggerdesign/LaravelBlogDemo"> https://github.com/triggerdesign/LaravelBlogDemo</a></p>
<h3>A short introduction</h3>
<p>The server based script language PHP is well known for its less than desirable syntax, it is easy to use and runs on nearly every webserver without any further configuration. It is easy to create small web applications like a blog or a simple CMS with PHP, but bigger systems need a reliable architecture.</p>
<p>You need a lot of knowledge and have to spend a lot of time for a stable web application that makes use of modern technologies and software patterns such as MVC, ORMs and REST.</p>
<p>This is why Frameworks are important for professional web developers. But why should you reinvent the wheel, if there are awesome Frameworks that you can install and use for free.  A Framework should not only provide you shortcuts, tools and components, it should also have a good documentation and an active community.</p>
<p>Laravel is a framework that delivers everything you need for coding a web application of any size. You can use Laravel for small projects, but it also grows with your needs.<br />
This is the reason why Laravel currently is the most hyped PHP Framework:</p>
<div class="blog-highlightarea">
<p><a rel="gallery[174]" class="imglink" href="http://triggerdesign.de/wordpress/wp-content/uploads/php-frameworks.jpg"</a><img class="wp-image-184 aligncenter" src="http://triggerdesign.de/wordpress/wp-content/uploads/php-frameworks.jpg" alt="php frameworks" width="507" height="398" /></a></p>
</div>
<p>If you want to read more about this topic I recommend you this article: <a href="http://www.sitepoint.com/best-php-frameworks-2014/">Sitepoint &#8211; PHP Frameworks 2014</a></p>
<h4>You don&#8217;t like text based tutorials?</h4>
<p>You can skip the complete Requirements and installation section if you watch this free video tutorial made by the famous Jeffrey Way:</p>
<p><strong><a href="https://laracasts.com/series/laravel-from-scratch/episodes/1">https://laracasts.com/series/laravel-from-scratch/episodes/1</a></strong></p>
<p>If feel like a pro and prefer a quick start you can also read a shorter version of the Installation here:</p>
<p><strong><a href="http://laravel.com/docs/4.2/quick">http://laravel.com/docs/4.2/quick</a></strong></p>
<h3>Requirements</h3>
<p>I assume that you are using a Windows System for your daily work. If you are using a Mac or even Linux you will know how to use your command line to install the things you need.</p>
<p>This are the things you need to follow my presentation:</p>
<ul>
<li><b>A Linux environment</b>: It is easy to install Laravel if you use the right system. Because most websites run on a Linux based server we will use Ubuntu (please do not leave this tutorial now, you don’t have to be a Linux nerd to do this). You will also need SSH access to your server to run certain Laravel commands.</li>
<li><b>A Webserver: </b>You should install Apache (or Nginx) as a webserver, PHP 5.3 or greater and a MySQL Database together with phpMyAdmin.<br />
There are quadrillions of tutorials out there for this topic but I recommend watching this:<br />
Install a virtual Ubuntu Server on Windows: <a href="https://www.youtube.com/watch?v=Ykt3MeNwORQ">https://www.youtube.com/watch?v=Ykt3MeNwORQ</a><br />
Or rent a server somewhere, I am sure it will come with PHP, MySQL and phpMyAdmin.</li>
<li><b>An IDE or a Texteditor:</b> You can use the good old Windows notepad to develop Laravel applications, but an IDE like PhpStorm, Dreamweaver or Eclipse will help you a lot and increase your coding speed enormously. You will need FTP access (via your IDE or an FTP Client like <a href="https://filezilla-project.org/">FileZilla</a>) if you want to edit the files live on your webserver.</li>
</ul>
<p>When it is not possible for you to run a Linux system, you can also use Windows: <a href="http://www.wikihow.com/Install-Laravel-Framework-in-Windows">http://www.wikihow.com/Install-Laravel-Framework-in-Windows</a></p>
<p>If you can use Vagrant you can use the Laravel Homestead box, which is very easy to install: <a href="http://laravel.com/docs/4.2/homestead">http://laravel.com/docs/4.2/homestead</a></p>
<h3>Install Laravel</h3>
<h4>Install composer globally</h4>
<p><img class="size-medium wp-image-185 aligncenter" src="http://triggerdesign.de/wordpress/wp-content/uploads/logo-composer-transparent-252x300.png" alt="logo-composer-transparent" width="252" height="300" /></p>
<p>We will need “<strong>Composer</strong>” a package manager for PHP. This very helpful tool will download and update all your dependencies (like an authentication system, code generators and tons of other helpers and libraries) automatically.</p>
<p>Use an SSH client like “<strong>PuTTY</strong>” to connect to your server and paste in the following lines to install composer globally:</p><pre class="crayon-plain-tag">curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer</pre><p>When you now type in “<strong>composer</strong>” into you command line you will see some info about the composer commands you can use.</p>
<h4>Lets arrive</h4>
<p><img class="size-medium wp-image-189 aligncenter" src="http://triggerdesign.de/wordpress/wp-content/uploads/arrived-177x300.png" alt="arrived" width="177" height="300" /></p>
<p>&nbsp;</p>
<p>Now we will install the Laravel framework onto our web server. Instead of downloading the files like your grandma, you can use the thing you have just installed &#8211; <strong>composer</strong>:</p><pre class="crayon-plain-tag"># Go to your web folder
cd /var/www/httpdocs 

# Get the laravel installer
composer global require "laravel/installer=~1.1"

# Make the installer accessible via the "laravel" command
export PATH="$PATH:~/.composer/vendor/bin"

# Create a new laravel app with the name "superblog"
laravel new superblog</pre><p>Wait some seconds and lets watch the laravel installer doing its magic&#8230; After seeing the last composer output : &#8220;<em>Application ready! Build something amazing.</em>&#8221; you are ready to go!</p>
<h4><span style="font-size: 1em;">Take a look at Laravel</span></h4>
<p>Now your web folder will look like this:</p>
<ul>
<li>superblog
<ul>
<li>app/</li>
<li>bootstrap/</li>
<li>public/</li>
<li>vendor/</li>
<li>composer.json</li>
<li>artisan</li>
</ul>
</li>
</ul>
<p>Make sure your web server points to the &#8220;<strong>superblog/public</strong>&#8221; folder and give full rights to your &#8220;superblog/app/storage&#8221; folder:</p><pre class="crayon-plain-tag">sudo chmod -R 777 app/storage</pre><p></p>
<div class="blog-infofield">
<p>If you don&#8217;t follow the step above you will have to call &#8220;yourdomain.com/superblog/public/&#8221; instead of &#8220;yourdomain.com/&#8221; all the time, which is not very nice.</p>
</div>
<p>Visit your website and you will hopefully see the <strong>you have arrived</strong> logo.</p>
<h4>Our first Laravel application</h4>
<p><span class="blog-link-button ctnk-button ctnk-button-ico16 button-link"><a title="Our first Laravel application" href="http://triggerdesign.de/our-first-laravel-application/">Proceed</a></span></p>
]]></content:encoded>
			<wfw:commentRss>https://triggerdesign.de/getting-started-with-laravel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
