Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit abc844b

Browse files
authored
Merge pull request #56 from shinsenter/v2.0
Ready for launching defer.php v2.0
2 parents 550368b + 891197b commit abc844b

Some content is hidden

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

75 files changed

+7276
-4417
lines changed

.docker/Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Dockerfile
2+
FROM php:7-zts
3+
4+
# Install Composer, NPM
5+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6+
;apt update -y \
7+
;apt install -y nodejs npm git zip unzip \
8+
;npm i -g npm
9+
10+
CMD ["/usr/local/bin/composer", "docker"]

.docker/blackfire.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
mkdir -p /tmp/blackfire
4+
architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac)
5+
curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux/$architecture | tar zxp -C /tmp/blackfire
6+
mv /tmp/blackfire/blackfire /usr/bin/blackfire
7+
rm -Rf /tmp/blackfire
8+
9+
apt install -y wget gnupg2
10+
wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
11+
echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list
12+
apt update -y
13+
apt install -y blackfire-php

.docker/docker-compose.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '3'
2+
3+
services:
4+
test:
5+
tty: true
6+
privileged: true
7+
build: .
8+
image: defer-php-test
9+
container_name: defer-php
10+
hostname: defer-php-test
11+
volumes:
12+
- ..:/home/defer-php
13+
environment:
14+
- APP_ENV=local
15+
working_dir: /home/defer-php

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1-
* text=auto
2-
/public/* -diff -merge
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore
11+
/.editorconfig export-ignore

.php_cs

+27-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
<?php
22

33
/**
4-
* A PHP helper class to efficiently defer JavaScript for your website.
5-
* (c) 2019 AppSeeds https://appseeds.net/
4+
* Defer.php aims to help you concentrate on web performance optimization.
5+
* (c) 2021 AppSeeds https://appseeds.net/
66
*
7-
* @package shinsenter/defer.php
8-
* @since 1.0.0
7+
* PHP Version >=5.6
8+
*
9+
* @category Web_Performance_Optimization
10+
* @package AppSeeds
911
* @author Mai Nhut Tan <[email protected]>
10-
* @copyright 2019 AppSeeds
11-
* @see https://github.com/shinsenter/defer.php/blob/develop/README.md
12+
* @copyright 2021 AppSeeds
13+
* @license https://code.shin.company/defer.php/blob/master/LICENSE MIT
14+
* @link https://code.shin.company/defer.php
15+
* @see https://code.shin.company/defer.php/blob/master/README.md
1216
*/
1317

1418
$header = <<<'EOF'
15-
A PHP helper class to efficiently defer JavaScript for your website.
16-
(c) 2019 AppSeeds https://appseeds.net/
19+
Defer.php aims to help you concentrate on web performance optimization.
20+
(c) 2021 AppSeeds https://appseeds.net/
21+
22+
PHP Version >=5.6
1723
18-
@package shinsenter/defer.php
19-
@since 1.0.0
24+
@category Web_Performance_Optimization
25+
@package AppSeeds
2026
@author Mai Nhut Tan <[email protected]>
21-
@copyright 2019 AppSeeds
22-
@see https://github.com/shinsenter/defer.php/blob/develop/README.md
27+
@copyright 2021 AppSeeds
28+
@license https://code.shin.company/defer.php/blob/master/LICENSE MIT
29+
@link https://code.shin.company/defer.php
30+
@see https://code.shin.company/defer.php/blob/master/README.md
2331
EOF;
2432

2533
$rules = [
@@ -92,12 +100,16 @@ $rules = [
92100
];
93101

94102
$finder = \PhpCsFixer\Finder::create()
95-
->in(__DIR__)
103+
->in(__DIR__ . DIRECTORY_SEPARATOR)
96104
->name('*.php')
97-
->exclude('.idea')
105+
->exclude('.docker')
98106
->exclude('.ppm')
107+
->exclude('assets')
99108
->exclude('cache')
100-
->exclude('vendor')
109+
->exclude('patches')
110+
->exclude('public')
111+
->exclude('tests/v1')
112+
->exclude('v1')
101113
->ignoreDotFiles(true)
102114
->ignoreVCS(true);
103115

.uglifyjs

-27
This file was deleted.

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
All notable changes to `shinsenter/defer.php` will be documented in this file.
4+
5+
## 2.0.0
6+
7+
- Changed namespace and API
8+
- Optimized HTML processing performance

CONTRIBUTING.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](https://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Shin
3+
Copyright (c) 2019 AppSeeds
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)