Silex Starter Pack

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

An admin login system and control panel (styled mostly using Bootstrap) A very basic user authentication system allowing for sign up/log in/log out with users coming from a database. A console application allowing quick and easy development of console tasks

Screenshot

Installation

Create your project by typing the following command:

composer create-project deanc/silex-starter-pack your-project-name dev-master Decide on your any namespaces you are going to want to autoload and create the relevent directory structure under the src directory. Open up composer.json and adjust the autoload section to load your new namespace. An example would be:

,"autoload": { "psr-0": { "DCSilexStarterPack": "src/" ,"YourNameSomeProjectName" : "src/" } } Copy app/config.default.php to a new file in the same directory called app/config.php and fill in the configuration values. Run composer install Set up your vhost:

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...)

Go to http://ssp.dev or whatever you set up your vhost as and your basic application should be loaded.

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 YourNameProjectControllerAdminProject.php for a Project admin controller. Then mount it in index.php like so:

$app->mount('/a', new YourNameProjectControllerAdminProject());

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

Pagination: "soup/paginator" https://packagist.org/packages/soup/paginator Mailing: "swiftmailer/swiftmailer" https://packagist.org/packages/swiftmailer/swiftmailer

Author

Dean Clatworthy

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。