Skip to content

Latest commit

 

History

64 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SAGALAYA PHP-FRAMEWORK

Framework build based on lithium (https://github.com/UnionOfRAD/lithium), integrating Twig as View layer and Doctrine as Model layer. Using Doctrine and Twig building web application become more intuitive.

Installation instruction

  • Clone the framework to your application directory e.g git clone https://github.com/kiranatama/sagalaya.git app_dir
  • Change your connection setting (host/login/password/database) at app/config/bootstrap/connections.php
  • Change default root url ('/') at app/config/routes.php , default is redirected to Pages::view
  • Gain an overview with reading basic tutorial on running app

e.g Model creation use-case :

	
		$user = new User($this->request->data);
		
		if ($user->save()) {
			$this->redirect('Users::index');
		} else {
			$errors = $user->getErrors();
		}
		
		return compact('user', 'errors');
	

e.g Model Access use-case :

	
		$user = User::findOneById($id);
		$other = User::get($other_id);
		
		// access user repository
		$lastUser = User::getLastUserLogin();
	

e.g Model filtering use-case :

	
		$users = User::findAll(array(
			'where' => array(
				'and' => array(
					array('fullname' => array('neq' => 'someone')),
					array('created' => array('gte' => '2010-10-10'))
				), 
				'or' => array(
					array('public' => array('eq' => true))
				)
			),
			'leftJoin' => array(
				array('field' => 'profile',
					'leftJoin' => array(
						'field' => 'nationality',
						'where' => array(
							array('name' => array('eq' => 'Indonesia'))
						)
					)
				)
			)
		));
	

e.g View use-case :

	
		{{ user.fullname }}
		created : {{ user.created.format('M d, h:i') }}
		
		{% for user in users %}
			{{ user.fullname }}, {{ user.email }}
		{% endfor %} 
	

About

PHP Framework

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages