Skip to content

Commit 5bc7f1b

Browse files
authored
Merge pull request #44 from jekuer/dev_v2
V2
2 parents de252fa + b5ea564 commit 5bc7f1b

File tree

98 files changed

+4426
-1590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4426
-1590
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: [jekuer]

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
- [ ] My change requires a change to the Readme.md.
1717
- [ ] I have updated the Readme.md accordingly.
1818
- [ ] I have read the **CONTRIBUTING** document.
19-
- [ ] I have added tests to cover my changes.
20-
- [ ] All new and existing tests passed.
2119

2220
Pull requests should be thought of as a conversation. There will be some back and forth when trying to get code merged into this or any other project. With all but the simplest changes you can and should expect that the maintainers of the project will request changes to your code. Please be aware of that and check in after you open your PR in order to get your code merged in cleanly.
2321

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
deploy.php
22
node_modules/
3-
*.map
43

54
# Visual Studio Code from https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore
65
# Adjust to your needs.

.htaccess

Lines changed: 180 additions & 308 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Changelog
2+
3+
## Version 2
4+
### 2.0.0
5+
- major updates to the code base (+ a lot of bug fixes).
6+
- removing AMP functionality (due to the note by Google to no longer push AMP pages and since the included caching solution is almost as fast without the downsides).
7+
- adding TailwindCSS support (as optional feature).
8+
- implementing js and css optimization packages and therefore adding a completely new way to deploy the boilerplate.
9+
- optimizing documentation and contribution possibilities.
10+
- nginx option as an alternative for apache.
11+
- pre-build speed and GDPR YouTube integration feature.
12+
13+
## Version 1
14+
- 1.4.6: Micro optimization
15+
- 1.4.5: Bug fixes.
16+
- 1.4.4: Small updates (mainly to htaccess)
17+
- 1.4.3: Small updates to htaccess caching
18+
- 1.4.2: Sitemap bug fix
19+
- 1.4.1: Optimization of Directus caching, Google Tag Manager, htaccess SSL rewrite, and other tweaks
20+
- 1.4.0: Bug fixes, Docker compose template, sitemap generator update, and intelligent redirect for multilanguage use
21+
- 1.3.5: Bug fixes.
22+
- 1.3.4: Option to add last udpdate to sitemap via Directus.
23+
- 1.3.3: Optimization of redirect feature and Directus caching.
24+
- 1.3.2: Extensive bug fixing.
25+
- 1.3.1: Individual slug per language.
26+
- 1.3.0: Added Gettext support, including emulation fallback for servers not supporting native gettext.
27+
- 1.2.0: Optimization of language switcher and serviceworker cache; new redirect functionality; automated sitemap generation; better Directus support (incl. local cache).
28+
- 1.1.0: Added better multilanguage support (incl. language switcher).
29+
- 1.0.0: Initial release.

Gruntfile.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = function(grunt) {
2+
3+
// Project configuration.
4+
grunt.initConfig({
5+
pkg: grunt.file.readJSON('package.json'),
6+
paths: {
7+
src: {
8+
js: 'assets/js/*.js',
9+
swcache: 'serviceworker-cache.js'
10+
},
11+
dest: {
12+
jsMin: 'assets/js/all.min.js',
13+
swcacheMin: 'serviceworker-cache.min.js'
14+
}
15+
},
16+
clean: {
17+
jsMin: '<%= paths.dest.jsMin %>',
18+
swcacheMin: '<%= paths.dest.swcacheMin %>'
19+
},
20+
uglify: {
21+
swcache: {
22+
options: {
23+
compress: true,
24+
mangle: true,
25+
sourceMap: true
26+
},
27+
src: '<%= paths.src.swcache %>',
28+
dest: '<%= paths.dest.swcacheMin %>'
29+
},
30+
jsassets: {
31+
options: {
32+
compress: true,
33+
mangle: true,
34+
sourceMap: true
35+
},
36+
src: '<%= paths.src.js %>',
37+
dest: '<%= paths.dest.jsMin %>'
38+
}
39+
}
40+
});
41+
42+
// Load the plugin that provides the "clean" and "uglify" tasks.
43+
grunt.loadNpmTasks('grunt-contrib-clean');
44+
grunt.loadNpmTasks('grunt-contrib-uglify');
45+
46+
// Default task(s).
47+
grunt.registerTask('default', ['clean', 'uglify']);
48+
49+
};

README.md

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# PHP Microsite Boilerplate
22

3-
[![pagespeed-100](https://img.shields.io/badge/Lighthouse%20PageSpeed-100-success.svg)](https://developers.google.com/speed/pagespeed/insights/?url=https://phpmicrosite.jenskuerschner.de)
4-
[![amp-valid](https://img.shields.io/badge/AMP-valid-success.svg)](https://validator.ampproject.org/#url=https%3A%2F%2Fphpmicrosite.jenskuerschner.de%2Famp%2F)
3+
[![pagespeed-100](https://img.shields.io/badge/Lighthouse%20PageSpeed-100-success.svg)](https://pagespeed.web.dev/report?utm_source=psi&utm_medium=redirect&url=https://phpmicrosite.jenskuerschner.de)
54
[![pwa-valid](https://img.shields.io/badge/PWA-valid-success.svg)](https://phpmicrosite.jenskuerschner.de/)
65
[![w3c-css-valid](https://img.shields.io/badge/W3C%20CSS-valid-success.svg)](https://jigsaw.w3.org/css-validator/validator?uri=https%3A%2F%2Fphpmicrosite.jenskuerschner.de%2F&profile=css3svg&usermedium=all)
76
[![LICENSE](https://img.shields.io/badge/license-GPL%203.0-blue.svg)](https://github.com/jekuer/php-microsite-boilerplate/blob/master/LICENSE.txt)
@@ -15,87 +14,88 @@ Furthermore, it is often not possible to use most solutions, if you need to depl
1514

1615
This project wants to provide you with a framework and template for this exact case:
1716

18-
- You need to build a rather small website, with some functionality.
19-
- You choose PHP, because you want to do server-side scripting, while PHP is also maybe the only language, that runs on basically all hosting options.
20-
- You build this thing on your own or with a maximum of 1 other person, which makes best practice, but complex code structure more of an unnecessary overhead than a helpful concept.
21-
- You need to get it done fast, while you do not want to make compromises regarding security or performance.
17+
* You need to build a rather small website, with some functionality.
18+
* You choose PHP, because you want to do server-side scripting, while PHP is also maybe the only language, that runs on basically all hosting options.
19+
* You build this thing on your own or with a maximum of 1 other person, which makes best practice, but complex code structure more of an unnecessary overhead than a helpful concept.
20+
* You need to get it done fast, while you do not want to make compromises regarding security or performance.
21+
* You therefore do not care about clean code a lot ;).
2222

2323
Demo: <https://phpmicrosite.jenskuerschner.de/>
2424

2525
## Key Features
2626

27-
- Easy routing.
28-
- [Accelerated Mobile Pages (AMP)](https://amp.dev/) prepared.
29-
- [Progressive Web App (PWA)](https://web.dev/progressive-web-apps/) prepared.
30-
- Multilanguage prepared.
31-
- [Directus CMS](https://directus.io/) integration (incl. local cache).
32-
- GDPR and CCPA ready (regular site and AMP).
33-
- Intelligent serviceworker cache.
34-
- Gettext support for easy translation (+ fallback if not installed on the server).
35-
- SEO optimized.
36-
- Automated sitemap generation.
37-
- Optimized for Social sharing.
38-
- Extensive in-code documentation.
39-
- [Security Headers](https://securityheaders.com/) (.htaccess or via PHP)
40-
- Multiple security features (most of them require an Apache server!)
41-
- Prepared to run git deployment.
42-
- Developed to make it extremely easy for you to remove features or add your own things.
43-
44-
## Setup
45-
46-
1. Download the respective branch/tag and upload it to your website's folder - or clone the repo as you like.
47-
48-
2. Adjust it to your project:
49-
- Check the .htaccess file, if you run it on Apache. Mind the security headers and places, where a domain/path is specified (look for YOURDOMAIN.com).
50-
- If you do not run it on Apache, check the index.php for the security headers setup and make sure every request (except for files) is send to the index.php.
51-
- Adjust the value within config.php and also mind files, which are mentioned in the comments there.
52-
- Check /templates/general_meta.php and create the respective favicons.
53-
- Define your pages at the routing.php. (Mind legal notice and privacy policy to stay GDPR compliant!)
54-
- Create those pages (as specified before) as single php files within /pages.
55-
- Create respective files within /controller if necessary in your case.
56-
- Check the option to auto-redirect within multi-language at index.php and all.js.
57-
- Build the website with those pages, the style.css, and the all.js. Mind to minimize those files or adjust the way they get included at /templates/header.php and /templates/footer.php.
58-
- Adjust the footer at /templates/footer.php and /templates/footer_amp.php to your needs.
59-
60-
3. That's basically it.
61-
62-
You can make more changes and use more features, like:
63-
64-
- Setting up a deployment script (sample included) or the Directus integration.
65-
- Do even more - it's a well documented playground!
27+
* Easy routing.
28+
* [Progressive Web App (PWA)](https://web.dev/progressive-web-apps/) prepared.
29+
* Multilanguage prepared.
30+
* [Directus CMS](https://directus.io/) integration (incl. local cache).
31+
* Docker compose for local development.
32+
* [TailwindCSS](https://tailwindcss.com/) included (optional).
33+
* GDPR and CCPA ready.
34+
* Intelligent serviceworker cache.
35+
* Gettext support for easy translation (+ fallback if not installed on the server).
36+
* SEO optimized.
37+
* Automated sitemap generation.
38+
* Optimized for Social sharing.
39+
* Speed- & GDPR-optimized YouTube-Integration.
40+
* Optional CSS and JavaScript optimization with prepared build scripts.
41+
* Extensive in-code documentation.
42+
* [Security Headers](https://securityheaders.com/) (.htaccess or via PHP)
43+
* Multiple security features (most of them require an Apache server!)
44+
* Prepared to run git deployment.
45+
* Developed to make it extremely easy for you to remove features or add your own things.
46+
47+
## Usage
48+
49+
1. Download the respective branch/tag and upload it to your website's folder - or clone the repo as you like.
50+
51+
2. Adjust it to your project:
52+
* Check the .htaccess file, if you run it on Apache. Mind the security headers and places, where a domain/path is specified (look for YOURDOMAIN.com).
53+
* If you do not run it on Apache, check the index.php for the security headers setup and make sure every request (except for files) is send to the index.php. Check the nginx_deployment.sh - it is a pre-configured bash script to setup your nginx webserver.
54+
* Adjust the values within config.php and also mind files, which are mentioned in the comments there. Setup a connection to your Directus CMS if used.
55+
* Check /templates/general_meta.php and create the respective favicons.
56+
* Define your pages at the routing.php. (Mind legal notice and privacy policy to stay GDPR compliant!)
57+
* Create those pages (as specified before) as single php files within /pages.
58+
* Create respective files within /controller if necessary in your case.
59+
* Check the option to auto-redirect within multi-language at index.php and all.js.
60+
* Build the website with those pages, the style.css, and the all.js. Mind to minimize those files or adjust the way they get included at /templates/header.php and /templates/footer.php. If you use the prepared build script, you do not need to worry about this part.
61+
* Adjust the footer at /templates/footer.php to your needs.
62+
* Find more details in the in-code documentation - it's a well documented playground!
63+
64+
3. That is basically it regarding adjustments. You can find a more detailed sample setup guide [at the corresponding Medium blog post here](https://medium.com/@jenskuerschner/build-a-kick-ass-php-microsite-in-under-3h-f21b27b904d2).
65+
66+
4. Building the project, hardly depends on your configuration! If you are using the TailwindCSS integration, you need to use the included build script, which requires NodeJS! If you are going plain, you can skip on that. However, not using the build scripts would also not merge and minify the css and js files. Therefore, if possible for you, it is hardly recommended. For building:
67+
* make sure you are within the project's root directory with your terminal.
68+
* run `npm install`.
69+
* run `npm run build` to let the magic happen.
70+
* That's it. Feel free to do this manually on your local machine and upload it to your host - or use some build pipelines at whatever tool you are using.
6671

6772
BTW: It is recommended to use a CDN service (e.g. [Cloudflare](https://www.cloudflare.com/)) in order to speed it up even more.
6873

74+
## Local Development Setup
75+
76+
For local development, you can make use of the included docker-compose.yml
77+
1. Update the container name in the yml file.
78+
2. Download and install Docker Desktop.
79+
3. Adjust the `$the_page_url` in the config.php temporarily to "/".
80+
4. Run `docker-compose up -d` in the terminal at the project's root directory.
81+
5. Open the project at `localhost:80` (mind that you might see an SSL error - should be no blocker),
82+
6. Happy coding and testing.
83+
6984
## Contributing
7085

7186
Anyone is welcome to contribute, but mind the [guidelines](.github/CONTRIBUTING.md):
7287

73-
- [Bug reports](.github/CONTRIBUTING.md#bugs)
74-
- [Feature requests](.github/CONTRIBUTING.md#features)
75-
- [Pull requests](.github/CONTRIBUTING.md#pull-requests)
76-
77-
## Changelog
78-
79-
- 1.4.6: Micro optimization
80-
- 1.4.5: Bug fixes.
81-
- 1.4.4: Small updates (mainly to htaccess)
82-
- 1.4.3: Small updates to htaccess caching
83-
- 1.4.2: Sitemap bug fix
84-
- 1.4.1: Optimization of Directus caching, Google Tag Manager, htaccess SSL rewrite, and other tweaks
85-
- 1.4.0: Bug fixes, Docker compose template, sitemap generator update, and intelligent redirect for multilanguage use
86-
- 1.3.5: Bug fixes.
87-
- 1.3.4: Option to add last udpdate to sitemap via Directus.
88-
- 1.3.3: Optimization of redirect feature and Directus caching.
89-
- 1.3.2: Extensive bug fixing.
90-
- 1.3.1: Individual slug per language.
91-
- 1.3.0: Added Gettext support, including emulation fallback for servers not supporting native gettext.
92-
- 1.2.0: Optimization of language switcher and serviceworker cache; new redirect functionality; automated sitemap generation; better Directus support (incl. local cache).
93-
- 1.1.0: Added better multilanguage support (incl. language switcher).
94-
- 1.0.0: Initial release.
88+
* [Bug reports](.github/CONTRIBUTING.md#bugs)
89+
* [Feature requests](.github/CONTRIBUTING.md#features)
90+
* [Pull requests](.github/CONTRIBUTING.md#pull-requests)
9591

9692
## License
9793

98-
The code is available under the [GPU 3.0 license](LICENSE.txt).
94+
The code is available under the [GPL 3.0 license](LICENSE.txt).
95+
You can basically do anything with it, but mind that if you want to distribute your work based on this code, your work needs to be GPL licensed as well.
96+
This means that you can easily build your website with it, since this is no distribution. Distribution would be the case, if you sell a project based on this code to others or if you create public projects (no matter if you sell them or not). Even this would be all fine, as long as you license those projects also with GPL. :)
97+
Check the [license file](LICENSE.txt) for all details.
98+
9999

100100
## Inspired by
101101

0 commit comments

Comments
 (0)