Skip to content
Open

2.x #39

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f006791
update: PSR-12 styleguide
jaimerod Mar 2, 2020
78f8954
update: 2.x update for PSR-4 and PSR-12
jaimerod Mar 3, 2020
db15512
update: 2.x update for PSR-4 and PSR-12
jaimerod Mar 3, 2020
303be86
update to 4.x gulp for node 12 compatibility
jaimerod Mar 4, 2020
1bd12e4
update: Move testing to PHPUnit
jaimerod Mar 5, 2020
1b0064f
update: clean up use
jaimerod Mar 5, 2020
9e0fcbf
update: formatting for multi-line
jaimerod Mar 5, 2020
aac59fc
update: sleepy.js, still not tested
jaimerod Mar 5, 2020
0f4210e
update: no longer need this task runner
jaimerod Mar 5, 2020
5cdc066
update: latest core
jaimerod Mar 5, 2020
ebc88e1
update: whoops module
jaimerod Apr 2, 2020
32f996e
update: core
jaimerod Apr 2, 2020
32cc46f
update: docker initial commit
jaimerod Apr 2, 2020
4052c32
update: remove all modules to rename folder
jaimerod Jul 31, 2020
f24f5a3
update: 2.x performance, url class, and whoops update
jaimerod Jul 31, 2020
61b0de7
update module update
jaimerod Jul 31, 2020
4647f86
bugfix: updated error handling
jaimerod Oct 28, 2020
689a1ed
update: updated docker
jaimerod Oct 28, 2020
4da7608
update: add navigation by default
jaimerod Oct 28, 2020
115bf26
update: best practice to use h2 instead of h1
jaimerod Oct 28, 2020
15cfb41
update: fix template test
jaimerod Oct 28, 2020
1ce4746
update: navigation module w/ tests
jaimerod Oct 28, 2020
763e899
update: organized navigation test
jaimerod Oct 28, 2020
c8a509a
update: NVM, gulpfix, and package update
jaimerod Dec 23, 2021
b95011a
docker update
jaimerod Dec 23, 2021
577a836
update: node version
jaimerod Dec 23, 2021
f4bbd39
update: gulpfile, gulpsass 4, SM2GIT.bat
jaimerod Jan 10, 2022
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
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
src/js/vendor/*
node_modules/*
src/app/tests/simpletest/*
src/app/tests/*
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg

.vscode/
*.sublime-workspace
aspnet_client
node_modules
node_modules/
sleepy.sublime-project
src/.sass-cache
src/build
sleepy.sublime-project
18 changes: 11 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[submodule "src/app/core"]
path = src/app/core
path = src/app/sleepy
url = https://github.com/sleepymustache/core.git
[submodule "src/app/tests/simpletest"]
path = src/app/tests/simpletest
url = https://github.com/simpletest/simpletest.git
[submodule "src/app/modules/performance"]
path = src/app/modules/performance
url = https://github.com/sleepymustache/module-performance
url = https://github.com/sleepymustache/module-performance.git
branch = 2.x
[submodule "src/app/modules/url-class"]
path = src/app/modules/url-class
url = https://github.com/sleepymustache/module-urlclass
url = https://github.com/sleepymustache/module-urlclass.git
branch = 2.x
[submodule "src/app/modules/whoops"]
path = src/app/modules/whoops
url = https://github.com/sleepymustache/module-whoops.git
url = https://github.com/sleepymustache/module-whoops.git
branch = 2.x
[submodule "src/app/modules/navigation"]
path = src/app/modules/navigation
url = https://github.com/sleepymustache/module-navigation.git
branch = 2.x
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/fermium
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": "0.2.0",
"configurations": [{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"log": true,
"externalConsole": false,
"pathMappings": {
"/var/www/html/": "${workspaceRoot}/src",
},
"ignore": [
"**/vendor/**/*.php"
]
},
]
}
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"files.exclude": {
"dist": true,
"src\\app\\tests\\simpletest\\test\\test_with_parse_error.php": true,
"node_modules": true
},
"php.validate.run": "onType",
"files.associations": {
"*.tpl": "php"
},
"files.trimTrailingWhitespace": true,
"editor.rulers": [
100
],
}
78 changes: 36 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,39 @@
sleepyMUSTACHE - Basic Setup
===============================================================================
# sleepyMUSTACHE 2.0 - Basic Setup

sleepyMUSTACHE is a modular PHP micro-framework designed to provide solutions for everyday PHP
challenges. There are two editions: basic and routed. The basic edition is aimed at providing a
bare bones scaffolding for simple websites. While the routed version is focused on web application
development by including conrollers, modules, and views.
sleepyMUSTACHE is a PHP micro-framework designed to provide solutions for rapidly building websites
which are fast and secure. Our main goal is to create a framework that is enjoyable for developers
to use, while giving them fine grained control.

Getting Started
-------------------------------------------------------------------------------
Configuration is done in *src/settings.php* and *gulpfile.js*. You define your dev/stage/live
environments, debugging preferences, and set any globals you need for your application in
*settings.php*. Build settings are managed in *gulpfile.js*
There are two editions: basic and routed.

1. Initialize git and node modules:
The basic edition is aimed at providing a bare bones scaffolding for simple websites. While the
routed version is focused on web application and services development and includes controllers,
modules, and views. Both versions consists of the core and various modules which are easy to
understand and create.

``` bash
git submodule init
git submodule update
npm install
```
## Getting Started

2. In *gulpfile.js*, modify the configuration setting as necessary:
1. sleepyMUSTACHE settings

``` javascript
const devUrl = 'http://basic.local.com'; // This should match the web server hostname
const enableTests = false; // Set to true to enable simpletest
```
Configuration is done in *src/settings.php*. You define your dev/stage/live environments, debugging
preferences, and set any globals you need for your application in *settings.php*.

2. Development and tooling

3. Compile the code and start the develop/watch process by running:
NPM (node v.14), Gulp 4, and Docker are required and used to setup the environment and automate the
build process. The initial compile takes a few mins as Docker will download, compile, and setup the
development environment.

``` bash
npm develop
npm run develop
```

The compiled code will live in the *dist* folder. Development is done in the *src* folder and
compiled by gulp to the *dist* folder.
Development is done in the *src* folder and compiled by gulp to the *dist* folder. The dist folder
is automatically synced with the docker instance. Visual Studio Code will be preconfigured to hide
the dist folder to prevent confusion.

4. Configure the web server so that:
## Gulp Modules

* The web server root should point to the *dist* folder inside the repo
* The web server hostname matches the *devUrl* in *gulpfile.js*


Gulp Modules
-------------------------------------------------------------------------------
sleepyMUSTACHE Basic includes the following gulp modules in the build system:

* gulp-eslint - Processes files with ESLint
Expand All @@ -53,25 +43,28 @@ sleepyMUSTACHE Basic includes the following gulp modules in the build system:
* gulp-sourcemaps - Adds sourcemaps for SASS
* gulp-webpack - Minify and transpiles JavaScript

Whats included?
-------------------------------------------------------------------------------
The basic framework includes the core, SimpleTest, a tool for installing
[modules](https://github.com/sleepymustache/modules), and the build scripts.
## Whats included?

The basic framework includes the core, phpunit, a tool for installing
[modules](https://github.com/sleepymustache/modules) (sleepy.js), and the build scripts.

### Core functionality

The core consistes of 4 modules. See below for documentation:
The core consists of a few classes. See below for documentation:

* [Debugging](http://sleepymustache.com/documentation/class-Sleepy.Debug.html)
* [Hooks](http://www.sleepymustache.com/documentation/class-Sleepy.Hook.html)
* [Routing](http://sleepymustache.com/documentation/class-Sleepy.Router.html)
* AutoLoader
* Modules
* [Templating](http://www.sleepymustache.com/documentation/class-Sleepy.Template.html)

### Installing Modules

"sleepy.js" assists in finding and installing modules.
"sleepy.js" assists in finding and installing modules. The list of Modules is located on Github. We
encourage you to submit your modules as pull requests to have them added to the
[repository](https://github.com/sleepymustache/modules).

You can get a list of available modules:
Using the sleepy.js script, you can get a list of available modules:

``` bash
node sleepy --list
Expand All @@ -97,6 +90,7 @@ You can get more info about a module:

Learning More
-------------------------------------------------------------------------------
* Documentation about the core is available at [core repo](https://github.com/sleepymustache/core).
* Documentation about the core is available at [core
repo](https://github.com/sleepymustache/core).
* A list of existing modules can be found in the [modules
repo](https://github.com/sleepymustache/modules).
18 changes: 18 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM php:7.4-apache

RUN a2enmod rewrite

RUN docker-php-ext-install pdo pdo_mysql

# Comment to remove xdebug which can be very slow
# RUN yes | pecl install xdebug \
# && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.default_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_port=9000" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_host=host.docker.internal" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.idekey=VSCODE" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_autostart=1" >> /usr/local/etc/php/conf.d/xdebug.ini \
# && echo "xdebug.remote_log=/usr/local/etc/php/xdebug.log" >> /usr/local/etc/php/conf.d/xdebug.ini
22 changes: 22 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: '3'

services:
db:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: p@ssw0rd
MYSQL_DATABASE: sleepy
MYSQL_USER: sleepy
MYSQL_PASSWORD: sleepy
ports:
- "3336:3306"
web:
build: .
depends_on:
- db
volumes:
- ../dist/:/var/www/html/
ports:
- "8888:80"
stdin_open: true
tty: true
Loading