deanc / silex-starter-pack

A starter pack for beginning development with the Silex PHP framework. Includes a basic admin control panel, and user login system.
12 stars 8 forks source link
php silex silex-framework silex-skeleton symfony

Silex Starter Pack

The Silex Starter Pack is a simple bootstrap to help you begin your project with Silex. It includes:

Screenshot

Admin Homepage

Installation

    composer create-project deanc/silex-starter-pack your-project-name dev-master
    ,"autoload": {
        "psr-0": {
            "DC\\SilexStarterPack": "src/"
            ,"YourName\\SomeProjectName" : "src/"
        }
    }

Build in PHP web-server quick start instructions:

Navigate into the web directory and type php -S 127.0.0.1:8080

Apache instructions:

<VirtualHost *:80>
     ServerAdmin webmaster@dummy-host2.example.com
     DocumentRoot "/Users/deanclatworthy/Projects/silex-starter-pack/web"
     <Directory "/Users/deanclatworthy/Projects/silex-starter-pack/web">
        Options -Indexes FollowSymLinks
        AllowOverride All
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*)$ /index.php [QSA,L]
        </IfModule>
    </Directory>
     ServerName ssp.dev
     ErrorLog "/private/var/log/apache2/silex-starter-pack.dev-error_log"
     CustomLog "/private/var/log/apache2/silex-starter-pack.dev-access_log" common
</VirtualHost>

(Nginx instructions coming soon...)

Admin Control Panel

The admin control panel is located at http://ssp.dev/a/. If you want to add any new admin controllers add them under your own namespace such as YourName\Project\Controller\Admin\Project.php for a Project admin controller. Then mount it in index.php like so:

$app->mount('/a', new YourName\Project\Controller\Admin\Project());

Bonus stuff

Twilio

If you want to use Twilio require their library:

composer require twilio/sdk

Enable the utility in app/config.php:

define('TWILIO_ENABLED', true);

Use it as follows:

$app['twilo']->send($from, $to, $text);

Reccommended Libraries

Author

Dean Clatworthy