├── TODO.md
├── app-mvc
├── .gitignore
├── .htaccess
├── 1projeto
├── README.md
├── application
│ ├── Controller
│ │ ├── CustomersController.php
│ │ ├── ErrorController.php
│ │ ├── HomeController.php
│ │ └── ProductsController.php
│ ├── Core
│ │ ├── Model.php
│ │ └── Router.php
│ ├── Libs
│ │ └── helper.php
│ ├── Model
│ │ ├── Customer.php
│ │ └── Product.php
│ ├── bootstrap.php
│ ├── config
│ │ └── config.php
│ └── view
│ │ ├── _templates
│ │ ├── footer.php
│ │ └── header.php
│ │ ├── customers
│ │ ├── edit.php
│ │ └── index.php
│ │ ├── error
│ │ └── index.php
│ │ ├── home
│ │ └── index.php
│ │ └── products
│ │ ├── edit.php
│ │ └── index.php
├── composer.json
├── db-my.sql
├── db-pg.sql
└── public
│ ├── .htaccess
│ ├── css
│ └── style.css
│ └── index.php
├── app-mvc2
├── .gitignore
├── .htaccess
├── README.md
├── application
│ ├── Controller
│ │ ├── CustomersController.php
│ │ ├── ErrorController.php
│ │ └── HomeController.php
│ ├── Core
│ │ ├── Model.php
│ │ └── Router.php
│ ├── Libs
│ │ └── helper.php
│ ├── Model
│ │ └── Customer.php
│ ├── bootstrap.php
│ ├── config
│ │ └── config.php
│ └── view
│ │ ├── _templates
│ │ ├── footer.php
│ │ └── header.php
│ │ ├── customers
│ │ ├── edit.php
│ │ └── index.php
│ │ ├── error
│ │ └── index.php
│ │ └── home
│ │ └── index.php
├── composer.json
├── db
│ ├── migrations
│ │ ├── 20190821114033_customers.php
│ │ └── 20190821175812_products.php
│ └── seeds
│ │ ├── Customers.php
│ │ └── Products.php
├── phinx.yml
└── public
│ ├── .htaccess
│ ├── css
│ └── style.css
│ └── index.php
├── app-mvc3
├── .gitignore
├── .htaccess
├── 1projeto
├── RE
├── application
│ ├── Controller
│ │ ├── CustomersController.php
│ │ ├── ErrorController.php
│ │ └── HomeController.php
│ ├── Core
│ │ ├── Model.php
│ │ └── Router.php
│ ├── Libs
│ │ └── helper.php
│ ├── Model
│ │ └── Customer.php
│ ├── bootstrap.php
│ ├── config
│ │ └── config.php
│ └── view
│ │ ├── _templates
│ │ ├── footer.php
│ │ └── header.php
│ │ ├── customers
│ │ ├── edit.php
│ │ └── index.php
│ │ ├── error
│ │ └── index.php
│ │ └── home
│ │ └── index.php
├── composer.json
├── db
│ ├── migrations
│ │ ├── 20190821114033_customers.php
│ │ └── 20190821175812_products.php
│ └── seeds
│ │ ├── Customers.php
│ │ └── Products.php
├── phinx.yml
└── public
│ ├── .htaccess
│ ├── css
│ ├── bootstrap.css
│ ├── bootstrap.min.css
│ ├── custom.css
│ └── style.css
│ └── index.php
├── app-mvc4
├── .gitignore
├── .htaccess
├── README.md
├── composer.json
├── db-my.sql
├── db-pg.sql
├── packages-add.md
├── public
│ ├── .htaccess
│ ├── css
│ │ └── custom.css
│ ├── images
│ │ └── mvc.png
│ └── index.php
└── src
│ ├── Controller
│ ├── CustomersController.php
│ ├── ErrorController.php
│ └── HomeController.php
│ ├── Core
│ ├── Model.php
│ └── Router.php
│ ├── Libs
│ └── Helper.php
│ ├── Model
│ └── Customer.php
│ ├── bootstrap.php
│ ├── config
│ └── config.php
│ └── view
│ ├── _templates
│ ├── footer.php
│ └── header.php
│ ├── customers
│ ├── edit.php
│ └── index.php
│ ├── error
│ └── index.php
│ └── home
│ └── index.php
├── app-mvc5
├── .gitignore
├── .htaccess
├── README.md
├── composer.json
├── db-my.sql
├── db-pg.sql
├── packages-add.md
├── public
│ ├── .htaccess
│ ├── css
│ │ └── custom.css
│ ├── images
│ │ └── mvc.png
│ └── index.php
└── src
│ ├── Controller
│ ├── CustomersController.php
│ ├── ErrorController.php
│ └── HomeController.php
│ ├── Core
│ ├── Model.php
│ └── Router.php
│ ├── Libs
│ └── Helper.php
│ ├── Model
│ └── CustomersModel.php
│ ├── View.php
│ ├── bootstrap.php
│ ├── config
│ └── config.php
│ └── view
│ ├── _templates
│ ├── footer.php
│ └── header.php
│ ├── customers
│ ├── add.php
│ ├── edit.php
│ └── index.php
│ ├── error
│ └── index.php
│ └── home
│ └── index.php
├── docs
├── .htaccess
├── 1-introducao.md
├── 2-Porque.md
├── 3-Justificativa.md
├── 4-PadroesProjeto.md
├── 4mvc1.png
├── 4mvc2.png
├── 5-BoasPraticas.md
├── 6-Rotas.md
├── 7-TratamentoErros.md
├── README.md
├── app-mvc4
│ ├── 0Estrutura.md
│ ├── 10.1css.md
│ ├── 11.1Finalizando.md
│ ├── 11.2Migrations.md
│ ├── 11.3Faker.md
│ ├── 11.4Woops.md
│ ├── 12Namespaces.md
│ ├── 13BootStrap4.md
│ ├── 1composer.json.md
│ ├── 2index.php.md
│ ├── 3bootstrap.php.md
│ ├── 4config.php.md
│ ├── 5.1htaccess.md
│ ├── 5.2htaccess.md
│ ├── 5.3Router.php.md
│ ├── 6Helper.php.md
│ ├── 7.1Model.php.md
│ ├── 7.2Customer.php.md
│ ├── 8.1ErrorController.php.md
│ ├── 8.2HomeController.php.md
│ ├── 8.3CustomersController.php.md
│ ├── 9.1error-index.php.md
│ ├── 9.2home-index.php.md
│ ├── 9.3.1header.php.md
│ ├── 9.3.2footer.php.md
│ ├── 9.4.1customers-edit.md
│ └── 9.4.2customers-index.md
└── mini-fw6_tela.png
├── mini-fw5
├── .gitignore
├── .htaccess
├── README.md
├── composer.json
├── db-my.sql
├── db-pg.sql
├── packages-add.md
├── public
│ ├── .htaccess
│ ├── css
│ │ └── custom.css
│ ├── images
│ │ └── mvc.png
│ └── index.php
└── src
│ ├── Controller
│ ├── CustomersController.php
│ ├── ErrorController.php
│ └── HomeController.php
│ ├── Core
│ ├── Model.php
│ └── Router.php
│ ├── Libs
│ └── Helper.php
│ ├── Model
│ └── CustomersModel.php
│ ├── View.php
│ ├── bootstrap.php
│ ├── config
│ └── config.php
│ └── view
│ ├── _templates
│ ├── footer.php
│ └── header.php
│ ├── customers
│ ├── add.php
│ ├── edit.php
│ └── index.php
│ ├── error
│ └── index.php
│ └── home
│ └── index.php
├── mini-fw6
├── .gitignore
├── .htaccess
├── Changes.md
├── README.md
├── TODO
├── composer.json
├── db-my.sql
├── db-pg.sql
├── packages-add.md
├── public
│ ├── .htaccess
│ ├── css
│ │ └── custom.css
│ ├── images
│ │ └── mvc.png
│ └── index.php
└── src
│ ├── Controller
│ ├── CustomersController.php
│ ├── ErrorController.php
│ └── ProductsController.php
│ ├── Core
│ ├── Model.php
│ └── Router.php
│ ├── Libs
│ └── Helper.php
│ ├── Model
│ ├── CustomersModel.php
│ └── ProductsModel.php
│ ├── View
│ ├── CustomersView.php
│ └── ProductsView.php
│ ├── bootstrap.php
│ ├── config
│ └── config.php
│ └── template
│ ├── _templates
│ ├── footer.php
│ └── header.php
│ ├── customers
│ ├── add.php
│ ├── edit.php
│ └── index.php
│ ├── error
│ └── index.php
│ └── products
│ ├── add.php
│ ├── edit.php
│ └── index.php
└── mini-mvc
├── .htaccess
├── README.md
├── app
├── Controller
│ ├── ClientesController.php
│ ├── ErrorController.php
│ ├── FuncionariosController.php
│ ├── HomeController.php
│ └── ProdutosController.php
├── Core
│ ├── Application.php
│ └── Model.php
├── Libs
│ └── helper.php
├── Model
│ ├── Cliente.php
│ ├── Funcionario.php
│ └── Produto.php
├── config
│ └── config.php
└── view
│ ├── _templates
│ ├── footer.php
│ └── header.php
│ ├── clientes
│ ├── edit.php
│ └── index.php
│ ├── error
│ └── index.php
│ ├── funcionarios
│ ├── edit.php
│ └── index.php
│ ├── home
│ └── index.php
│ └── produtos
│ ├── edit.php
│ └── index.php
├── composer.json
├── db.sql
├── divulgacao
├── public
├── .htaccess
├── css
│ └── style.css
├── img
│ └── demo-image.png
├── index.php
└── js
│ └── application.js
└── vendor
├── autoload.php
└── composer
├── ClassLoader.php
├── LICENSE
├── autoload_classmap.php
├── autoload_namespaces.php
├── autoload_psr4.php
├── autoload_real.php
├── autoload_static.php
└── installed.json
/TODO.md:
--------------------------------------------------------------------------------
1 | # Lembrando que o aplicativo base não tem qualquer dependência.
2 |
3 | ## Explicar com detalhes o sistema de rotas:
4 | - .htaccess (os dois)
5 | - public/index.php
6 | - application/bootstrap.php
7 | - application/Core/Router.php (aqui inserir paradas e comentar...)
8 |
9 | ## As 3 dependências/pacotes instalados são úteis, mas opcionais, podendo ser removidos.
10 |
11 | - Paginação (Dividir para view, controller e model)
12 | - Busca (Dividir para view, controller e model)
13 | - Usar o mais que puder de metdados dos SGBDs para tornar o aplicativo menos trabalhoso de codificar, puxando as informações diretamente do banco de dados usando os referidos metadados
14 | - Definir rota default no config.php e implementar no Router.php
15 |
16 | ## Criar novas classes para usar:
17 |
18 | ## Front
19 | - form com bons recursos: input, select, radio, check, etc
20 | - table
21 | - links
22 | - images
23 | - modal
24 | - popups com Bootstrap
25 | - tooltip com BS
26 | - datagrid
27 |
28 | ## Arquivos de template:
29 | - header
30 | - footer
31 |
32 |
--------------------------------------------------------------------------------
/app-mvc/.gitignore:
--------------------------------------------------------------------------------
1 | vendor
2 | composer.lock
3 |
--------------------------------------------------------------------------------
/app-mvc/.htaccess:
--------------------------------------------------------------------------------
1 | RewriteEngine on
2 | RewriteRule ^(.*) public/$1 [L]
3 |
--------------------------------------------------------------------------------
/app-mvc/application/Controller/ErrorController.php:
--------------------------------------------------------------------------------
1 | user_name !
32 | // For example, fetch mode FETCH_ASSOC would return results like this: $result["user_name] !
33 | // @see http://www.php.net/manual/en/pdostatement.fetch.php
34 | $options = array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ, PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING);
35 |
36 | // generate a database connection, using the PDO connector
37 | // @see http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/
38 | $dsn = DB_TYPE . ':host=' . DB_HOST . ';port ='. DB_PORT . ';dbname=' . DB_NAME;// . $databaseEncodingenc;
39 | $this->db = new PDO($dsn , DB_USER, DB_PASS, $options);
40 |
41 | }
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/app-mvc/application/Libs/helper.php:
--------------------------------------------------------------------------------
1 | $value) {
25 |
26 | // check if named parameters (':param') or anonymous parameters ('?') are used
27 | if (is_string($key)) {
28 | $keys[] = '/' . $key . '/';
29 | } else {
30 | $keys[] = '/[?]/';
31 | }
32 |
33 | // bring parameter into human-readable format
34 | if (is_string($value)) {
35 | $values[$key] = "'" . $value . "'";
36 | } elseif (is_array($value)) {
37 | $values[$key] = implode(',', $value);
38 | } elseif (is_null($value)) {
39 | $values[$key] = 'NULL';
40 | }
41 | }
42 |
43 | /*
44 | echo "
[DEBUG] Keys:
"; 45 | print_r($keys); 46 | 47 | echo "\n[DEBUG] Values: "; 48 | print_r($values); 49 | echo ""; 50 | */ 51 | 52 | $raw_sql = preg_replace($keys, $values, $raw_sql, 1, $count); 53 | 54 | return $raw_sql; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app-mvc/application/bootstrap.php: -------------------------------------------------------------------------------- 1 | 17 | * 18 | * For more info about namespaces plase @see http://php.net/manual/en/language.namespaces.importing.php 19 | */ 20 | 21 | // set a constant that holds the project's folder path, like "/var/www/". 22 | // DIRECTORY_SEPARATOR adds a slash to the end of the path 23 | define('ROOT', dirname(__DIR__) . DIRECTORY_SEPARATOR); 24 | 25 | // set a constant that holds the project's "application" folder, like "/var/www/application". 26 | define('APP', ROOT . 'application' . DIRECTORY_SEPARATOR); 27 | 28 | // This is the auto-loader for Composer-dependencies (to load tools into your project). 29 | require_once ROOT . 'vendor/autoload.php'; 30 | 31 | // load application config (error reporting etc.) 32 | require_once APP . 'config/config.php'; 33 | 34 | // load application class 35 | use Mvc\Core\Router; 36 | 37 | // start the application 38 | $app = new Router(); 39 | -------------------------------------------------------------------------------- /app-mvc/application/config/config.php: -------------------------------------------------------------------------------- 1 | 3 | Find MINI3 on GitHub. 4 | If you like the project, support it by using Rackspace as your hoster [affiliate link]. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 |