aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Micieli <micieli@laposte.net>2019-08-17 20:47:23 +0200
committerWilly Micieli <micieli@laposte.net>2019-08-17 20:47:23 +0200
commit26a1ca984c6cff1c5337e92c6a56b85ffc1dbc06 (patch)
treef2eafebf8d2ced086684cca1b1ae6e3955afa539
downloadshaolin-26a1ca984c6cff1c5337e92c6a56b85ffc1dbc06.zip
shaolin-26a1ca984c6cff1c5337e92c6a56b85ffc1dbc06.tar.gz
start arch
-rw-r--r--.env.example0
-rw-r--r--.gitignore6
-rw-r--r--app/Console/Sample.php29
-rw-r--r--app/Container/admin.php5
-rw-r--r--app/Container/web.php5
-rw-r--r--app/Controllers/WelcomeController.php57
-rw-r--r--app/Helpers/admin.php2
-rw-r--r--app/Helpers/web.php2
-rw-r--r--app/Middleware/AppMiddleware.php27
-rw-r--r--app/Models/Users.php18
-rw-r--r--app/Routes/routes.sqlite3bin0 -> 20480 bytes
-rw-r--r--app/Views/Welcome/welcome.twig21
-rw-r--r--app/Views/admin.twig28
-rw-r--r--app/Views/layout.twig28
-rw-r--r--composer.json32
-rw-r--r--config/.gitignore1
-rw-r--r--config/admin.yaml1
-rw-r--r--config/article.yaml12
-rw-r--r--config/auth.yaml18
-rw-r--r--config/back.yaml2
-rw-r--r--config/db.example.yaml9
-rw-r--r--config/flash.yaml4
-rw-r--r--config/form.yaml22
-rw-r--r--config/git.yaml49
-rw-r--r--config/hash.yaml2
-rw-r--r--config/locales.yaml4
-rw-r--r--config/mail.yaml12
-rw-r--r--config/navigation.yaml6
-rw-r--r--config/pagination.yaml4
-rw-r--r--config/shop.yaml0
-rw-r--r--config/twig.yaml9
-rw-r--r--logs/.gitignore2
-rw-r--r--phinx.php28
-rw-r--r--phpunit-printer.yml14
-rw-r--r--phpunit.xml27
-rw-r--r--po/.gitignore1
-rw-r--r--shaolin10
-rw-r--r--web/.htaccess21
-rw-r--r--web/css/app.css0
-rw-r--r--web/img/img.txt0
-rw-r--r--web/index.php7
-rw-r--r--web/js/app.js3
-rw-r--r--web/robots.txt2
43 files changed, 530 insertions, 0 deletions
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/.env.example
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..eae70c5
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,6 @@
+/vendor/
+.env
+*.lock
+tmp
+cache
+.idea
diff --git a/app/Console/Sample.php b/app/Console/Sample.php
new file mode 100644
index 0000000..c81a449
--- /dev/null
+++ b/app/Console/Sample.php
@@ -0,0 +1,29 @@
+<?php
+
+ namespace App\Console;
+
+ use Symfony\Component\Console\Command\Command;
+ use Symfony\Component\Console\Input\InputInterface;
+ use Symfony\Component\Console\Output\OutputInterface;
+
+ class Sample extends Command
+ {
+ protected static $defaultName = "hello";
+
+ protected function configure()
+ {
+ $this->setDescription('Say hello');
+ }
+
+
+ public function interact(InputInterface $input, OutputInterface $output)
+ {
+
+ }
+ public function execute(InputInterface $input, OutputInterface $output)
+ {
+ $output->writeln('<info>Welcome at Shaolin ! </info>');
+ return 0;
+ }
+
+ } \ No newline at end of file
diff --git a/app/Container/admin.php b/app/Container/admin.php
new file mode 100644
index 0000000..988f5b3
--- /dev/null
+++ b/app/Container/admin.php
@@ -0,0 +1,5 @@
+<?php
+
+ return [
+
+ ];
diff --git a/app/Container/web.php b/app/Container/web.php
new file mode 100644
index 0000000..988f5b3
--- /dev/null
+++ b/app/Container/web.php
@@ -0,0 +1,5 @@
+<?php
+
+ return [
+
+ ];
diff --git a/app/Controllers/WelcomeController.php b/app/Controllers/WelcomeController.php
new file mode 100644
index 0000000..3f33c8d
--- /dev/null
+++ b/app/Controllers/WelcomeController.php
@@ -0,0 +1,57 @@
+<?php
+
+namespace App\Controllers {
+
+ use Imperium\Controller\Controller;
+ use Symfony\Component\HttpFoundation\Response;
+ use Twig\Error\LoaderError;
+ use Twig\Error\RuntimeError;
+ use Twig\Error\SyntaxError;
+
+ /**
+ * Class WelcomeController
+ *
+ * @package App\Controllers
+ *
+ */
+ Class WelcomeController extends Controller
+ {
+
+ /**
+ *
+ * Executed before an action
+ *
+ */
+ public function before_action()
+ {
+
+ }
+
+ /**
+ * Executed after an action
+ */
+ public function after_action()
+ {
+
+ }
+
+ /**
+ *
+ * The homepage
+ *
+ * @throws LoaderError
+ * @throws RuntimeError
+ * @throws SyntaxError
+ *
+ * @return Response
+ *
+ */
+ public function welcome(): Response
+ {
+
+ return $this->view('@welcome/welcome');
+ }
+
+ }
+
+}
diff --git a/app/Helpers/admin.php b/app/Helpers/admin.php
new file mode 100644
index 0000000..a4abe2d
--- /dev/null
+++ b/app/Helpers/admin.php
@@ -0,0 +1,2 @@
+<?php
+
diff --git a/app/Helpers/web.php b/app/Helpers/web.php
new file mode 100644
index 0000000..a4abe2d
--- /dev/null
+++ b/app/Helpers/web.php
@@ -0,0 +1,2 @@
+<?php
+
diff --git a/app/Middleware/AppMiddleware.php b/app/Middleware/AppMiddleware.php
new file mode 100644
index 0000000..aff5710
--- /dev/null
+++ b/app/Middleware/AppMiddleware.php
@@ -0,0 +1,27 @@
+<?php
+
+ namespace App\Middleware;
+
+ use GuzzleHttp\Psr7\Response;
+ use Imperium\Middleware\Middleware;
+ use Psr\Http\Message\ResponseInterface;
+ use Psr\Http\Message\ServerRequestInterface;
+
+ class AppMiddleware implements Middleware
+ {
+
+ /**
+ * Handles a request and produces a response.
+ *
+ * May call other collaborating code to generate the response.
+ *
+ * @param ServerRequestInterface $request
+ *
+ * @return ResponseInterface
+ */
+ public function handle(ServerRequestInterface $request) : ResponseInterface
+ {
+ return new Response();
+ }
+
+ } \ No newline at end of file
diff --git a/app/Models/Users.php b/app/Models/Users.php
new file mode 100644
index 0000000..b1f32fc
--- /dev/null
+++ b/app/Models/Users.php
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Models {
+
+ use Imperium\Model\Model;
+
+ Class Users extends Model
+ {
+
+ protected $table = 'users';
+
+ protected static $by = 'id';
+
+ protected static $limit = 20;
+
+ }
+
+}
diff --git a/app/Routes/routes.sqlite3 b/app/Routes/routes.sqlite3
new file mode 100644
index 0000000..d3e8715
--- /dev/null
+++ b/app/Routes/routes.sqlite3
Binary files differ
diff --git a/app/Views/Welcome/welcome.twig b/app/Views/Welcome/welcome.twig
new file mode 100644
index 0000000..0ee627e
--- /dev/null
+++ b/app/Views/Welcome/welcome.twig
@@ -0,0 +1,21 @@
+{% extends 'layout.twig' %}
+
+{% block title '' %}
+
+{% block description '' %}
+
+{% block css %}
+
+{% endblock %}
+
+{% block content %}
+
+
+
+{% endblock %}
+
+{% block js %}
+
+
+
+{% endblock %}
diff --git a/app/Views/admin.twig b/app/Views/admin.twig
new file mode 100644
index 0000000..97959f3
--- /dev/null
+++ b/app/Views/admin.twig
@@ -0,0 +1,28 @@
+<!doctype html>
+<html lang="{{ lang() }}">
+ <head>
+ <!-- Required meta tags -->
+ <meta charset="utf-8">
+
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+ {% if development() %}
+
+ {% endif %}
+
+ {{ css('app') }}
+
+ {% block css %} {% endblock %}
+
+ <title>{% block title %}{% endblock %}</title>
+
+ <meta name="description" content="{% block description %} {% endblock %}">
+ </head>
+ <body>
+ <main class="container">
+ {{ display('success') }}
+ {{ display('failure') }}
+ {% block content %} {% endblock %}
+ </main>
+ </body>
+</html> \ No newline at end of file
diff --git a/app/Views/layout.twig b/app/Views/layout.twig
new file mode 100644
index 0000000..97959f3
--- /dev/null
+++ b/app/Views/layout.twig
@@ -0,0 +1,28 @@
+<!doctype html>
+<html lang="{{ lang() }}">
+ <head>
+ <!-- Required meta tags -->
+ <meta charset="utf-8">
+
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+ {% if development() %}
+
+ {% endif %}
+
+ {{ css('app') }}
+
+ {% block css %} {% endblock %}
+
+ <title>{% block title %}{% endblock %}</title>
+
+ <meta name="description" content="{% block description %} {% endblock %}">
+ </head>
+ <body>
+ <main class="container">
+ {{ display('success') }}
+ {{ display('failure') }}
+ {% block content %} {% endblock %}
+ </main>
+ </body>
+</html> \ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..ee51fb5
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,32 @@
+{
+ "name": "shaolin/shaolin",
+ "description": "A small mvc framework",
+ "type": "project",
+ "license": "GPL-3.0-or-later",
+ "authors": [
+ {
+ "name": "Willy Micieli",
+ "email": "micieli@laposte.net"
+ }
+ ],
+ "require": {
+ "imperium/imperium": "^10.2"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/"
+ },
+ "files": [
+ "app/Helpers/web.php",
+ "app/Helpers/admin.php"
+ ]
+ },
+ "scripts": {
+ "post-create-project-cmd": [
+ "cp .env.example .env",
+ "cp config/db.example.yaml config/db.yaml",
+ "@php shaolin route:generate",
+ "@php shaolin hello"
+ ]
+ }
+}
diff --git a/config/.gitignore b/config/.gitignore
new file mode 100644
index 0000000..d11fe27
--- /dev/null
+++ b/config/.gitignore
@@ -0,0 +1 @@
+db.yaml
diff --git a/config/admin.yaml b/config/admin.yaml
new file mode 100644
index 0000000..0baf0f7
--- /dev/null
+++ b/config/admin.yaml
@@ -0,0 +1 @@
+limit_table_char: 20
diff --git a/config/article.yaml b/config/article.yaml
new file mode 100644
index 0000000..8753e23
--- /dev/null
+++ b/config/article.yaml
@@ -0,0 +1,12 @@
+columns:
+ slug: 'slug'
+ title: 'title'
+ content: 'content'
+ image: 'img'
+ primary: 'id'
+ created_at: 'created_at'
+ updated_at: 'update_at'
+limit: 70
+read: 'Read more'
+read_class: 'btn btn-primary'
+prefix: '/article'
diff --git a/config/auth.yaml b/config/auth.yaml
new file mode 100644
index 0000000..f7bc13a
--- /dev/null
+++ b/config/auth.yaml
@@ -0,0 +1,18 @@
+table: 'users'
+admin_prefix: '/admin'
+user_home: '/home'
+create_action: '/create'
+columns:
+ password: 'password'
+ id: 'id'
+ auth: 'id'
+messages:
+ welcome: 'Welcome'
+ user_not_found: 'User was not found'
+ password_no_match: 'Password not match'
+ account_created_successfully: 'Your account has been successfully created'
+ account_creation_fail: 'Sorry your account has not been created'
+ bye: 'Bye'
+ not_unique: 'Username must be unique'
+ table_not_found: 'The table was not found'
+ reset_fail: 'The password has not been modified'
diff --git a/config/back.yaml b/config/back.yaml
new file mode 100644
index 0000000..aafd9a0
--- /dev/null
+++ b/config/back.yaml
@@ -0,0 +1,2 @@
+message: 'Go back'
+class: 'text-success' \ No newline at end of file
diff --git a/config/db.example.yaml b/config/db.example.yaml
new file mode 100644
index 0000000..3724543
--- /dev/null
+++ b/config/db.example.yaml
@@ -0,0 +1,9 @@
+driver: mysql
+base: imperium
+username: root
+password: root
+dump: dump
+host: localhost
+port: 3306
+hidden_tables:
+ - migrations \ No newline at end of file
diff --git a/config/flash.yaml b/config/flash.yaml
new file mode 100644
index 0000000..9460075
--- /dev/null
+++ b/config/flash.yaml
@@ -0,0 +1,4 @@
+success:
+ class: 'alert alert-success alert-dismissible fade show'
+failure:
+ class: 'alert alert-danger alert-dismissible fade show' \ No newline at end of file
diff --git a/config/form.yaml b/config/form.yaml
new file mode 100644
index 0000000..0d6b704
--- /dev/null
+++ b/config/form.yaml
@@ -0,0 +1,22 @@
+class:
+ submit: 'btn-outline-primary text-uppercase'
+ reset: 'btn-danger'
+ remove: 'btn-danger'
+ button: 'btn-secondary'
+ link: 'btn-primary'
+ group: 'btn-secondary'
+ checkbox: 'form-control'
+ edit: 'btn btn-primary'
+ delete : 'btn btn-danger'
+ table: 'table table-bordered table-hover'
+textarea:
+ col: 10
+ row: 5
+save: true
+padding: 2
+margin: 2
+validate: false
+large: true
+small: false
+pagination_step: 10
+space: true \ No newline at end of file
diff --git a/config/git.yaml b/config/git.yaml
new file mode 100644
index 0000000..2f92d21
--- /dev/null
+++ b/config/git.yaml
@@ -0,0 +1,49 @@
+archives_extensions:
+ - tar.gz
+ - zip
+readme:
+ - README.md
+ - readme.md
+ - README.mkd
+ - readme.mkd
+ - README.rst
+ - readme.rst
+ - README.html
+ - readme.html
+ - README.htm
+ - readme.htm
+ - README.txt
+ - readme.txt
+ - README
+ - readme
+ - INSTALL.md
+ - install.md
+ - INSTALL.mkd
+ - install.mkd
+ - INSTALL.rst
+ - install.rst
+ - INSTALL.html
+ - install.html
+ - INSTALL.htm
+ - install.htm
+ - INSTALL.txt
+ - install.txt
+ - INSTALL
+ - install
+licences:
+ - LICENSE
+ - LICENSE.md
+ - LICENSE.txt
+ - BSD-3-Clause-Clear
+ - GPL-2.0
+ - BSD-3-Clause
+ - BSD-2-Clause
+ - MIT
+ - MIT-LICENSE
+changelog:
+ - CHANGELOG.md
+
+contributing:
+ - CONTRIBUTING.md
+
+private: true \ No newline at end of file
diff --git a/config/hash.yaml b/config/hash.yaml
new file mode 100644
index 0000000..8906d85
--- /dev/null
+++ b/config/hash.yaml
@@ -0,0 +1,2 @@
+algorithm: 'sha256'
+secret: 'secrets' \ No newline at end of file
diff --git a/config/locales.yaml b/config/locales.yaml
new file mode 100644
index 0000000..1c6c4b2
--- /dev/null
+++ b/config/locales.yaml
@@ -0,0 +1,4 @@
+locale: 'fr'
+supported: ['fr']
+domain: 'messages'
+dir: 'po' \ No newline at end of file
diff --git a/config/mail.yaml b/config/mail.yaml
new file mode 100644
index 0000000..f86564f
--- /dev/null
+++ b/config/mail.yaml
@@ -0,0 +1,12 @@
+smtp: 'localhost'
+port: 1025
+username: ''
+password: ''
+dir: 'Emails'
+domain: ''
+selector: ''
+from: 'git@git.fumseck.eu'
+passphrase: ''
+bcc: ''
+cc: ''
+html: false
diff --git a/config/navigation.yaml b/config/navigation.yaml
new file mode 100644
index 0000000..1a16064
--- /dev/null
+++ b/config/navigation.yaml
@@ -0,0 +1,6 @@
+routes :
+ login : 'login@Connexion'
+ register : 'register@Inscription'
+ admin : 'admin@admin'
+ home: 'home@home'
+ logout: 'logout@logout' \ No newline at end of file
diff --git a/config/pagination.yaml b/config/pagination.yaml
new file mode 100644
index 0000000..9a6d0cd
--- /dev/null
+++ b/config/pagination.yaml
@@ -0,0 +1,4 @@
+url: '?page='
+link_class: 'page-link'
+ul_class: 'pagination mt-5'
+li_class: 'page-item' \ No newline at end of file
diff --git a/config/shop.yaml b/config/shop.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/config/shop.yaml
diff --git a/config/twig.yaml b/config/twig.yaml
new file mode 100644
index 0000000..3002955
--- /dev/null
+++ b/config/twig.yaml
@@ -0,0 +1,9 @@
+namespaces:
+ Welcome: 'welcome'
+config:
+ cache: 'cache'
+ charset: 'utf-8'
+ auto_reload: true
+ debug: false
+ strict_variables: true
+development: true \ No newline at end of file
diff --git a/logs/.gitignore b/logs/.gitignore
new file mode 100644
index 0000000..d6b7ef3
--- /dev/null
+++ b/logs/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/phinx.php b/phinx.php
new file mode 100644
index 0000000..60682ce
--- /dev/null
+++ b/phinx.php
@@ -0,0 +1,28 @@
+<?php
+
+$x = app()->connect();
+
+return
+[
+ "paths" =>
+ [
+ "migrations" => "db/migrations",
+ "seeds" => "db/seeds"
+ ],
+ "environments" =>
+ [
+ "default_migration_table" => "migrations",
+
+ 'default_database' => 'development',
+
+ 'development' =>
+ [
+ "adapter" => $x->driver(),
+ "host" => $x->host(),
+ "name" => $x->base(),
+ "user" => $x->user(),
+ "pass" => $x->password(),
+ "port" => db('port'),
+ ]
+ ]
+];
diff --git a/phpunit-printer.yml b/phpunit-printer.yml
new file mode 100644
index 0000000..5e0d3b9
--- /dev/null
+++ b/phpunit-printer.yml
@@ -0,0 +1,14 @@
+options:
+ cd-printer-hide-class: false
+ cd-printer-simple-output: false
+ cd-printer-show-config: true
+ cd-printer-hide-namespace: true
+ cd-printer-anybar: false
+ cd-printer-anybar-port: 1738
+markers:
+ cd-pass: "✓ "
+ cd-fail: "✖ "
+ cd-error: "⚈ "
+ cd-skipped: "→ "
+ cd-incomplete: "∅ "
+ cd-risky: "⌽ "
diff --git a/phpunit.xml b/phpunit.xml
new file mode 100644
index 0000000..7ba92c2
--- /dev/null
+++ b/phpunit.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ bootstrap="vendor/autoload.php"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="true"
+ printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
+
+ <testsuites>
+ <testsuite name="Unit">
+ <directory suffix="Test.php">./tests/Unit</directory>
+ </testsuite>
+
+ <testsuite name="Feature">
+ <directory suffix="Test.php">./tests/Feature</directory>
+ </testsuite>
+ </testsuites>
+ <filter>
+ <whitelist processUncoveredFilesFromWhitelist="true">
+ <directory suffix=".php">./app</directory>
+ </whitelist>
+ </filter>
+</phpunit>
diff --git a/po/.gitignore b/po/.gitignore
new file mode 100644
index 0000000..c90071a
--- /dev/null
+++ b/po/.gitignore
@@ -0,0 +1 @@
+*.mo \ No newline at end of file
diff --git a/shaolin b/shaolin
new file mode 100644
index 0000000..277d6f3
--- /dev/null
+++ b/shaolin
@@ -0,0 +1,10 @@
+#!/usr/bin/env php
+<?php
+
+
+use Imperium\Command\Command;
+
+require 'vendor/autoload.php';
+
+exit((new Command('shaolin','1.0'))->run());
+
diff --git a/web/.htaccess b/web/.htaccess
new file mode 100644
index 0000000..93b066c
--- /dev/null
+++ b/web/.htaccess
@@ -0,0 +1,21 @@
+<IfModule mod_rewrite.c>
+ <IfModule mod_negotiation.c>
+ Options -MultiViews -Indexes
+ </IfModule>
+
+ RewriteEngine On
+
+ # Handle Authorization Header
+ RewriteCond %{HTTP:Authorization} .
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
+ # Redirect Trailing Slashes If Not A Folder...
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_URI} (.+)/$
+ RewriteRule ^ %1 [L,R=301]
+
+ # Handle Front Controller...
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^ index.php [L]
+</IfModule> \ No newline at end of file
diff --git a/web/css/app.css b/web/css/app.css
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web/css/app.css
diff --git a/web/img/img.txt b/web/img/img.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/web/img/img.txt
diff --git a/web/index.php b/web/index.php
new file mode 100644
index 0000000..7ce753b
--- /dev/null
+++ b/web/index.php
@@ -0,0 +1,7 @@
+<?php
+
+ chdir(dirname(__DIR__));
+
+ require_once 'vendor/autoload.php';
+
+ app()->run();
diff --git a/web/js/app.js b/web/js/app.js
new file mode 100644
index 0000000..8e224cc
--- /dev/null
+++ b/web/js/app.js
@@ -0,0 +1,3 @@
+$(function () {
+
+}); \ No newline at end of file
diff --git a/web/robots.txt b/web/robots.txt
new file mode 100644
index 0000000..eb05362
--- /dev/null
+++ b/web/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: