Download the PHP package rizkiarm/slim-starter-x without Composer
On this page you can find all versions of the php package rizkiarm/slim-starter-x. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package slim-starter-x
SlimStarterX
SlimStarterX is a bootstrap application built with Slim Framework in MVC architecture, with Laravel's Eloquent as database provider (Model), Twig as template engine (View) and Phinx as a migration utility.
Additional package is Sentry as authentication provider and Slim-facade which provide easy access to underlying Slim API with static interface like Laravel syntax (built based on Laravel's Facade).
Original project by xsanity: https://github.com/xsanisty/SlimStarter
Changes:
Here are few changes that has been made to the original application
- Added: Phinx as a migration utility, replacing the original migrate.php
- Added: Yii-like base Model
- Added: base Controller with CSRF support
- Added: Illuminate/Validation for Model Validation
- Added: ValidatorFacade and CsrfProtectionFacade
Installation
1 Manual Install
You can manually install SlimStarterX by cloning this repo or download the zip file from this repo, and run .
2 Install via
Alternatively, you can use to install SlimStarterX without downloading zip or cloning this repo.
3 Setup Permission
After composer finished install the dependencies, you need to change file and folder permission.
4 Configure and Setup Database
Configure your database configuration in app/config/database.php
. Run the user migration using the following command inside app
folder
Configuration
Configuration file of SlimStarter located in , edit the database.php, cookie.php and other to match your need. After you've done configuring, open path-to-application/public/seed
in your browser, before you can login with the following credential.
Routing
Routing configuration is located in , it use Route facade to access underlying Slim router. If you prefer the 'Slim' way, you can use $app to access Slim instance
Route to closure
Route to controller method
Route Middleware
Route group
Route Resource this will have same effect on route group above like Laravel Route::resource
RouteController
Model
Models are located in directory, since Eloquent is used as database provider, you can write model like you write model for Laravel, for complete documentation about eloquent, please refer to http://laravel.com/docs/eloquent
file : app/models/Book.php
Note: Eloquent has some limitations due to dependency to some Laravel's and Symfony's components which is not included, such as , , and validation method, which is depend on , , , etc.
Controller
Controllers are located in directory, you may extends the BaseController to get access to predefined helper. You can also place your controller in namespace to group your controller.
file : app/controllers/HomeController.php
Controller helper
Get reference to Slim instance
You can access Slim instance inside your controller by accessing $app property
Loading javascript assets or CSS assets
SlimStarter shipped with default master template with js and css asset already in place, to load your own js or css file you can use or , or to remove js or css, or to remove all queued js or css file.
Publish PHP variable to javascript
You can also publish PHP variable to make it accessible via javascript (must extends master.twig)
the user variable will be accessible in 'global' namespace
Default variable available in template
View
Views file are located in directory in twig format, there is master.twig with 'body' block as default master template shipped with SlimStarer that will provide default access to published js variable.
For detailed Twig documentation, please refer to http://twig.sensiolabs.org/documentation
file : app/views/welcome.twig
Rendering view inside controller
If your controller extends the BaseController class, you will have access to $data property which will be the placeholder for all view's data.
Hooks and Middlewares
You can still hook the Slim event, or registering Middleware to Slim instance in , Slim instance is accessible in variable.
You can write your own middleware class in directory.
file : app/middlewares/SomeActionMiddleware.php
Models
Rules & Messages
Example
More
Example:
- app/models/ExampleModel.php
Illiminate validation official documentation:
Find
Example
Load, Validate, Save & Delete
Example
Hooks
Base Model also have hooks before some events, your Model can now implement:
CSRF Protection
By default the CSRF protection are on, add this line in your controller to disable it.
To use CSRF protection, add this code inside your html form
Notes
In case autoloader cannot resolve your classes, do so composer can resolve your class location
All versions of slim-starter-x with dependencies
slim/slim Version 2.4.*
slim/views Version 0.1.2
twig/twig Version 1.*
twig/extensions Version *
itsgoingd/slim-facades Version dev-master
illuminate/database Version 4.*
cartalyst/sentry Version 2.*
ircmaxell/password-compat Version 1.0.*