<?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>Sebastian Müller</title>
	<atom:link href="http://www.sebastian-mueller.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sebastian-mueller.net</link>
	<description>Blog von Sebastian Müller aus Hamm</description>
	<lastBuildDate>Thu, 09 Feb 2012 20:07:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Silex sinnvoll einsetzen &#8211; Eine kleine Einführung</title>
		<link>http://www.sebastian-mueller.net/silex-sinnvoll-einsetzen-eine-kleine-einfuhrung/</link>
		<comments>http://www.sebastian-mueller.net/silex-sinnvoll-einsetzen-eine-kleine-einfuhrung/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 20:07:29 +0000</pubDate>
		<dc:creator>Sebastian Müller</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Silex]]></category>

		<guid isPermaLink="false">http://www.sebastian-mueller.net/?p=16</guid>
		<description><![CDATA[Über das PHP Micro-Framework Silex wird zur Zeit immer häufiger Berichtet. Das auf Symfony2-Komponenten basierende Micro-Framework hat sich vieles bei dem Ruby Micro-Framework Sinatra abgeschaut, was auch völlig positiv zu bewerten ist. Denn dieses Konzept hat sich schön länger in der Ruby Community bewährt. Hier mal ein kleines Beispiel wie man Silex verwendet: Wie in [...]]]></description>
			<content:encoded><![CDATA[<p>Über das PHP Micro-Framework <a href="http://silex.sensiolabs.org" target="_blank">Silex</a> wird zur Zeit immer häufiger Berichtet. Das auf Symfony2-Komponenten basierende Micro-Framework hat sich vieles bei dem Ruby Micro-Framework <a href="http://www.sinatrarb.com/" target="_blank">Sinatra</a> abgeschaut, was auch völlig positiv zu bewerten ist. Denn dieses Konzept hat sich schön länger in der Ruby Community bewährt.<br />
<span id="more-16"></span><br />
Hier mal ein kleines Beispiel wie man Silex verwendet:</p>
<style type="text/css">


/* *************************************************** */
/* WordPress default theme "twenty-ten" compatibility: */
/* FIXME: Is there a way to limit these changes to pygmentize_mysJQQ  */
/*        without editing the WordPress theme directly? */
/* *************************************************** */

#content pre {
  /* The background: transparent is needed to work with WordPress:*/
  background: transparent;
  /* Default WordPress style has a big fat <pre> margin-bottom: */
  margin-bottom: 0px;

  /*color: #333333;*/
  font-size: .9em; 
  line-height: 1.25em;
}

#content table {
}

#content table {
	border: 1px solid #e7e7e7;
    margin: 0 0 0 0;
	text-align: left;
	width: 100%;
}
#content tr th,
#content thead th {
	color: #888;
	font-size: 12px;
	font-weight: bold;
	line-height: 18px;
	padding: 0px;
}
#content tr td {
	border: 0px;
	padding: 0px;
	margin: 0px;
    margin-bottom: 0px;
    padding-bottom: 0px;

}

/* *************************************************** */
/* *************************************************** */

/* Standard fixes to the default output: */

/* Set the tab width in "ch" character units: */
.pygmentize_mysJQQ .tabspan {
  display: inline-block;
  width: 4ch;
}

/* When using line numbers, use 100% table width and no cellpadding: */
.pygmentize_mysJQQtable {
  width: 100%;
  border-spacing: 0px;
  border-collapse: collapse;
}


/*
#content table {
    border: 1px solid #E7E7E7;
    margin: 0 -1px 24px 0;
    text-align: left;
    width: 100%;
}
*/

.pygmentize_mysJQQtable td, .pygmentize_mysJQQtable th {
  padding: 0px;
  margin: 0px;
}

/* Add a little buffer so the monotype font doesn't bump directly against the edge: */
.pygmentize_mysJQQ pre {
  padding: .6ch;
  color: #F8F8F2;
}

/* This is more consistent with <p> tags... I didn't like it for my use: */
/*
div .pygmentize_mysJQQ {
    margin-bottom: 24px; 
}
*/

td.linenos.pygmentize_mysJQQ {
  width: 1ch;
  padding: .6ch;
  line-height: 1.25em;
}

.pygmentize_mysJQQ td {
  padding-right: 1px;
}


td.linenos { background-color: #f0f0f0; padding-right: 1px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
.pygmentize_mysJQQ .hll { background-color: #49483e }
.pygmentize_mysJQQ  { background: #272822; color: #f8f8f2 }
.pygmentize_mysJQQ .c { color: #75715e } /* Comment */
.pygmentize_mysJQQ .err { color: #960050; background-color: #1e0010 } /* Error */
.pygmentize_mysJQQ .k { color: #66d9ef } /* Keyword */
.pygmentize_mysJQQ .l { color: #ae81ff } /* Literal */
.pygmentize_mysJQQ .n { color: #f8f8f2 } /* Name */
.pygmentize_mysJQQ .o { color: #f92672 } /* Operator */
.pygmentize_mysJQQ .p { color: #f8f8f2 } /* Punctuation */
.pygmentize_mysJQQ .cm { color: #75715e } /* Comment.Multiline */
.pygmentize_mysJQQ .cp { color: #75715e } /* Comment.Preproc */
.pygmentize_mysJQQ .c1 { color: #75715e } /* Comment.Single */
.pygmentize_mysJQQ .cs { color: #75715e } /* Comment.Special */
.pygmentize_mysJQQ .ge { font-style: italic } /* Generic.Emph */
.pygmentize_mysJQQ .gs { font-weight: bold } /* Generic.Strong */
.pygmentize_mysJQQ .kc { color: #66d9ef } /* Keyword.Constant */
.pygmentize_mysJQQ .kd { color: #66d9ef } /* Keyword.Declaration */
.pygmentize_mysJQQ .kn { color: #f92672 } /* Keyword.Namespace */
.pygmentize_mysJQQ .kp { color: #66d9ef } /* Keyword.Pseudo */
.pygmentize_mysJQQ .kr { color: #66d9ef } /* Keyword.Reserved */
.pygmentize_mysJQQ .kt { color: #66d9ef } /* Keyword.Type */
.pygmentize_mysJQQ .ld { color: #e6db74 } /* Literal.Date */
.pygmentize_mysJQQ .m { color: #ae81ff } /* Literal.Number */
.pygmentize_mysJQQ .s { color: #e6db74 } /* Literal.String */
.pygmentize_mysJQQ .na { color: #a6e22e } /* Name.Attribute */
.pygmentize_mysJQQ .nb { color: #f8f8f2 } /* Name.Builtin */
.pygmentize_mysJQQ .nc { color: #a6e22e } /* Name.Class */
.pygmentize_mysJQQ .no { color: #66d9ef } /* Name.Constant */
.pygmentize_mysJQQ .nd { color: #a6e22e } /* Name.Decorator */
.pygmentize_mysJQQ .ni { color: #f8f8f2 } /* Name.Entity */
.pygmentize_mysJQQ .ne { color: #a6e22e } /* Name.Exception */
.pygmentize_mysJQQ .nf { color: #a6e22e } /* Name.Function */
.pygmentize_mysJQQ .nl { color: #f8f8f2 } /* Name.Label */
.pygmentize_mysJQQ .nn { color: #f8f8f2 } /* Name.Namespace */
.pygmentize_mysJQQ .nx { color: #a6e22e } /* Name.Other */
.pygmentize_mysJQQ .py { color: #f8f8f2 } /* Name.Property */
.pygmentize_mysJQQ .nt { color: #f92672 } /* Name.Tag */
.pygmentize_mysJQQ .nv { color: #f8f8f2 } /* Name.Variable */
.pygmentize_mysJQQ .ow { color: #f92672 } /* Operator.Word */
.pygmentize_mysJQQ .w { color: #f8f8f2 } /* Text.Whitespace */
.pygmentize_mysJQQ .mf { color: #ae81ff } /* Literal.Number.Float */
.pygmentize_mysJQQ .mh { color: #ae81ff } /* Literal.Number.Hex */
.pygmentize_mysJQQ .mi { color: #ae81ff } /* Literal.Number.Integer */
.pygmentize_mysJQQ .mo { color: #ae81ff } /* Literal.Number.Oct */
.pygmentize_mysJQQ .sb { color: #e6db74 } /* Literal.String.Backtick */
.pygmentize_mysJQQ .sc { color: #e6db74 } /* Literal.String.Char */
.pygmentize_mysJQQ .sd { color: #e6db74 } /* Literal.String.Doc */
.pygmentize_mysJQQ .s2 { color: #e6db74 } /* Literal.String.Double */
.pygmentize_mysJQQ .se { color: #ae81ff } /* Literal.String.Escape */
.pygmentize_mysJQQ .sh { color: #e6db74 } /* Literal.String.Heredoc */
.pygmentize_mysJQQ .si { color: #e6db74 } /* Literal.String.Interpol */
.pygmentize_mysJQQ .sx { color: #e6db74 } /* Literal.String.Other */
.pygmentize_mysJQQ .sr { color: #e6db74 } /* Literal.String.Regex */
.pygmentize_mysJQQ .s1 { color: #e6db74 } /* Literal.String.Single */
.pygmentize_mysJQQ .ss { color: #e6db74 } /* Literal.String.Symbol */
.pygmentize_mysJQQ .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.pygmentize_mysJQQ .vc { color: #f8f8f2 } /* Name.Variable.Class */
.pygmentize_mysJQQ .vg { color: #f8f8f2 } /* Name.Variable.Global */
.pygmentize_mysJQQ .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.pygmentize_mysJQQ .il { color: #ae81ff } /* Literal.Number.Integer.Long */

  </style>




<div class="pygmentize_mysJQQ"><pre><span class="cp">&lt;?php</span>
<span class="c1">// Einbindung des Frameworks mit Hilfe einer Phar-Datei </span>
<span class="k">require_once</span> <span class="nx">__DIR__</span><span class="o">.</span><span class="s1">&#39;/silex.phar&#39;</span><span class="p">;</span>

<span class="c1">// Application erzeugen </span>
<span class="nv">$app</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Silex</span><span class="err">\</span><span class="nx">Application</span><span class="p">();</span>

<span class="c1">// die startseite</span>
<span class="nv">$app</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">,</span> <span class="nx">function</span><span class="p">()</span> <span class="nx">use</span> <span class="p">(</span><span class="nv">$app</span><span class="p">)</span> <span class="p">{</span>
   <span class="c1">// der code für die startseite</span>
<span class="p">});</span>

<span class="c1">// eine Kontaktseite die über /contact aufrufbar wäre</span>
<span class="nv">$app</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;/contact&#39;</span><span class="p">,</span> <span class="nx">function</span><span class="p">()</span> <span class="nx">use</span> <span class="p">(</span><span class="nv">$app</span><span class="p">)</span> <span class="p">{</span>
<span class="c1">// der eigentliche code für diese seite...</span>
<span class="p">});</span>

<span class="c1">// app ausführen</span>
<span class="nv">$app</span><span class="o">-&gt;</span><span class="na">run</span><span class="p">();</span>

<span class="cp">?&gt;</span>
</pre></div>


<p>Wie in dem Beispiel zu sehen kann man sehr schnell und einfach Unterseiten erstellen. Das Prinzip sollte jedem Programmierer schnell klar werden. Doch es sollten einige Dinge gut durchdacht werden, bevor man auf ein Micro-Framework wie Silex setzt.</p>
<h3>Wann es Sinn macht Silex einzusetzen</h3>
<p>Micro-Frameworks sollte man immer nur dann einsetzen, wenn es sich grundsätzlich um ein <strong>kleines Projekt</strong> handelt und man zu 100% weiß, dass es auch <strong>ein kleines Projekt bleibt</strong> <img src='http://www.sebastian-mueller.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Denn häufig ist es schwer abzuschätzen, ob ein Projekt nicht doch irgendwann total aufgebohrt wird und der ursprüngliche Umfang um ein Vielfaches überschritten wird. In diesem Fall kommen die Micro-Frameworks an ihre Grenzen und die Wartbarkeit der Projekte wird deutlich erschwert.</p>
<p>Wenn diesen Punkten nichts im Wege steht, ist Silex oft sehr gut einzusetzen. Einige Anwendungsbeispiele wären:</p>
<ul>
<li>Kleine APIs</li>
<li>Kleine Seitenprojekte einer großen Anwendung, die klar einem bestimmten Bereich zugeordnet werden können</li>
<li>Prototyp-Entwicklung</li>
</ul>
<h3>Eine gute Projektstruktur für Silex Projekte finden</h3>
<p>Sehr wichtig in jedem PHP-Projekt ist die Struktur. Und besonders beim Einsatz von Silex kann die Projektstruktur schnell vernachlässigt werden, weil es so schnell möglich ist eine Applikation umzusetzen. Für mich hat sich bereits mehrmals diese Struktur bewährt:</p>
<ul>
<li>
<em>/app</em><br /> Beinhaltet die eigentliche Application</p>
<ul>
<li><em>/cache</em><br />Hier ist Platz für Cache-Files</li>
<li><em>/logs</em><br />Alle Log-Dateien</li>
<li><em>app.php</em><br />Beinhaltet die Programmlogik</li>
</li>
<li><em>bootstrap.php</em><br /> Autolading, Registrierung von Services, Laden der Silex Phar-Datei</li>
</ul>
</li>
<li><em>/src</em><br /> Bibliotheken, die für das Projekt entwickelt wurden</li>
<li><em>/vendor</em><br />Alle Fremdbibliotheken sind hier enthalten, die im Projekt verwendet werden</li>
<li><em>/web</em><br />Enthält alle öffentlichen Dateien wie Scripts, Stylesheets, etc.
<ul>
<li><em>index.php</em><br />führt letztendlich die App aus mit <em>$app->run();</em> die in <em>/app/app.php</em> definiert wurde.
</ul>
</li>
</ul>
<p>Mit dieser Grundstruktur ist meiner Meinung schon ein großer Schritt zu einer sauber entwickelten App gemacht. Doch wie die App letztendlich programmiert wird, ist noch mal ein ganz anderes Thema <img src='http://www.sebastian-mueller.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian-mueller.net/silex-sinnvoll-einsetzen-eine-kleine-einfuhrung/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nice Coffeescript Introduction Tutorial</title>
		<link>http://www.sebastian-mueller.net/coffeescript-introduction-tutorial/</link>
		<comments>http://www.sebastian-mueller.net/coffeescript-introduction-tutorial/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 14:00:33 +0000</pubDate>
		<dc:creator>Sebastian Müller</dc:creator>
				<category><![CDATA[Coffeescript]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.sebastian-mueller.net/?p=11</guid>
		<description><![CDATA[Wer anfangen möchte sich mit Coffeescript zu beschäftigen, sollte sich das Video reinziehen. Es ist eine gute Einführung in die ganze Thematik.]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/18429839?title=0&amp;byline=0&amp;portrait=0" width="540" height="405" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>Wer anfangen möchte sich mit Coffeescript zu beschäftigen, sollte sich das Video reinziehen. Es ist eine gute Einführung in die ganze Thematik.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sebastian-mueller.net/coffeescript-introduction-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

