Skip to content

Commit

Permalink
Init import
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 4, 2012
0 parents commit c9033eb
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
/vendor/
/logs/*
!/logs/README.md
/templates/cache/*
!/templates/cache/README.md
.DS_STORE
21 changes: 21 additions & 0 deletions README.md
@@ -0,0 +1,21 @@
# Slim Framework Skeleton Application

Use this skeleton application to quickly setup and start working on a new Slim Framework applciation. This application uses the latest Slim and Slim-Extras repositories. It also uses Sensio Labs' [Twig](http://twig.sensiolabs.org) template library.

This skeleton application was built for Composer. This makes setting up a new Slim Framework application quick and easy.

## Install Composer

If you have not installed Composer, do that now. I prefer to install Composer globally in `/usr/local/bin`, but you may also install Composer locally in your current working directory. For this tutorial, I assume you have installed Composer locally.

<http://getcomposer.org/doc/00-intro.md#installation>

## Install the Application

After you install Composer, run this command from the directory in which you want to install your new Slim Framework application.

php composer.phar create-project slim/skeleton [my-app-name]

Replace <code>[my-app-name]</code> with the desired directory name for your new application. You'll want to point your virtual host document root to your new application's `public/` directory.

That's it! Now go build something cool.
20 changes: 20 additions & 0 deletions composer.json
@@ -0,0 +1,20 @@
{
"name": "slim/slim-skeleton",
"description": "A Slim Framework skeleton application for rapid development",
"keywords": ["microframework","rest","router"],
"homepage": "http://github.com/codeguy/Slim-Skeleton",
"license": "MIT",
"authors": [
{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "http://www.joshlockhart.com/"
}
],
"require": {
"php": ">=5.3.0",
"slim/slim": "1.6.*",
"slim/extras": "dev-release-1.0.3",
"twig/twig": ">=1.8.0,<2.0-dev"
}
}
1 change: 1 addition & 0 deletions logs/README.md
@@ -0,0 +1 @@
Your Slim Framework application's log files will be written to this directory.
10 changes: 10 additions & 0 deletions public/.htaccess
@@ -0,0 +1,10 @@
RewriteEngine On

# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
32 changes: 32 additions & 0 deletions public/index.php
@@ -0,0 +1,32 @@
<?php
require '../vendor/autoload.php';

// Prepare app
$app = new Slim(array(
'templates.path' => '../templates',
'log.level' => 4,
'log.enabled' => true,
'log.writer' => new Log_FileWriter(array(
'path' => '../logs',
'name_format' => 'y-m-d'
))
));

// Prepare view
$twigView = new View_Twig();
$twigView->twigOptions = array(
'charset' => 'utf-8',
'cache' => realpath('../templates/cache'),
'auto_reload' => true,
'strict_variables' => false,
'autoescape' => true
);
$app->view($twigView);

// Define routes
$app->get('/', function () use ($app) {
$app->render('index.html');
});

// Run app
$app->run();
10 changes: 10 additions & 0 deletions templates/_layout.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Slim Framework Skeleton</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
1 change: 1 addition & 0 deletions templates/cache/README.md
@@ -0,0 +1 @@
Your Slim Framework application's template cache files will be written to this directory.
5 changes: 5 additions & 0 deletions templates/index.html
@@ -0,0 +1,5 @@
{% extends "_layout.html" %}

{% block content %}
<h1>Congratulations! Your Slim Framework application works!</h1>
{% endblock %}

0 comments on commit c9033eb

Please sign in to comment.