Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .htrouter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/*
+------------------------------------------------------------------------+
| Phalcon Developer Tools |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
| Serghei Iakovlev <serghei@phalconphp.com> |
+------------------------------------------------------------------------+
*/

define('PUBLIC_PATH', __DIR__ . '/public');

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if ($uri !== '/' && file_exists(PUBLIC_PATH . $uri)) {
return false;
}
$_GET['_url'] = $_SERVER['REQUEST_URI'];

require_once PUBLIC_PATH . '/index.php';
Empty file added .phalcon/.gitkeep
Empty file.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ Check out a [explanation article][1].
To run this application on your machine, you need at least:

* PHP >= 5.4
* [Apache][2] Web Server with [mod_rewrite][3] enabled or [Nginx][4] Web Server
* Server Any of the following
* [Phalcon Devtools][7] using provided **.htrouter** and `phalcon serve` command
* [Apache][2] Web Server with [mod_rewrite][3] enabled
* [Nginx][4] Web Server
* Latest stable [Phalcon Framework release][5] extension enabled

## License

Phalcon Tutorial is open-sourced software licensed under the [New BSD License][6]. © Phalcon Framework Team and contributors

[1]: http://docs.phalconphp.com/en/latest/reference/tutorial.html
[1]: https://docs.phalconphp.com/en/latest/tutorial-base
[2]: http://httpd.apache.org/
[3]: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
[4]: http://nginx.org/
[5]: https://github.com/phalcon/cphalcon/releases
[6]: https://github.com/phalcon/tutorial/blob/master/docs/LICENSE.md
[7]: https://github.com/phalcon/phalcon-devtools
2 changes: 0 additions & 2 deletions app/models/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ class Users extends Model
{

public $id;

public $name;

public $email;

}
1 change: 0 additions & 1 deletion app/views/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
echo "<h1>Hello!</h1>";

echo $this->tag->linkTo("signup", "Sign Up Here!");

2 changes: 1 addition & 1 deletion docs/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
New BSD License
===============

Copyright (c) 2013-2015, Phalcon Framework Team and contributors
Copyright (c) 2013-2017, Phalcon Framework Team and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion docs/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
New BSD License

Copyright (c) 2013-2015, Phalcon Framework Team and contributors
Copyright (c) 2013-2017, Phalcon Framework Team and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
86 changes: 40 additions & 46 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,61 +1,55 @@
<?php

use Phalcon\Loader;
use Phalcon\Tag;
use Phalcon\Mvc\Url;
use Phalcon\Mvc\View;
use Phalcon\Mvc\Application;
use Phalcon\DI\FactoryDefault;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;

define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');

// Register an autoloader
$loader = new Loader();
$loader->registerDirs(
array(
APP_PATH . '/controllers/',
APP_PATH . '/models/'
)
)->register();

// Create a DI
$di = new FactoryDefault();

// Setting up the view component
$di['view'] = function() {
$view = new View();
$view->setViewsDir(APP_PATH . '/views/');
return $view;
};

// Setup a base URI so that all generated URIs include the "tutorial" folder
$di['url'] = function() {
$url = new Url();
$url->setBaseUri('/');
return $url;
};

// Set the database service
$di['db'] = function() {
return new DbAdapter(array(
"host" => "127.0.0.1",
"username" => "root",
"password" => "secret",
"dbname" => "tutorial1"
));
};

// Handle the request
try {

// Register an autoloader
$loader = new Loader();
$loader->registerDirs(
array(
'../app/controllers/',
'../app/models/'
)
)->register();

// Create a DI
$di = new FactoryDefault();

// Set the database service
$di['db'] = function() {
return new DbAdapter(array(
"host" => "localhost",
"username" => "root",
"password" => "secret",
"dbname" => "tutorial"
));
};

// Setting up the view component
$di['view'] = function() {
$view = new View();
$view->setViewsDir('../app/views/');
return $view;
};

// Setup a base URI so that all generated URIs include the "tutorial" folder
$di['url'] = function() {
$url = new Url();
$url->setBaseUri('/tutorial/');
return $url;
};

// Setup the tag helpers
$di['tag'] = function() {
return new Tag();
};

// Handle the request
$application = new Application($di);

echo $application->handle()->getContent();

} catch (Exception $e) {
echo "Exception: ", $e->getMessage();
}
11 changes: 6 additions & 5 deletions schemas/tutorial.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- MySQL dump 10.13 Distrib 5.5.36, for osx10.9 (i386)
--
-- Host: localhost Database: tutorial
-- Host: localhost Database: tutorial1
-- ------------------------------------------------------
-- Server version 5.5.36

Expand All @@ -23,10 +23,11 @@ DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(70) NOT NULL,
`email` varchar(70) NOT NULL,
PRIMARY KEY (`id`)
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(70) NOT NULL,
`email` varchar(70) NOT NULL,

PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand Down