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

Commit

Permalink
Merge pull request #56 from shinsenter/v2.0
Browse files Browse the repository at this point in the history
Ready for launching defer.php v2.0
  • Loading branch information
shinsenter authored Mar 25, 2021
2 parents 550368b + 891197b commit abc844b
Show file tree
Hide file tree
Showing 75 changed files with 7,276 additions and 4,417 deletions.
10 changes: 10 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Dockerfile
FROM php:7-zts

# Install Composer, NPM
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
;apt update -y \
;apt install -y nodejs npm git zip unzip \
;npm i -g npm

CMD ["/usr/local/bin/composer", "docker"]
13 changes: 13 additions & 0 deletions .docker/blackfire.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

mkdir -p /tmp/blackfire
architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac)
curl -A "Docker" -L https://blackfire.io/api/v1/releases/client/linux/$architecture | tar zxp -C /tmp/blackfire
mv /tmp/blackfire/blackfire /usr/bin/blackfire
rm -Rf /tmp/blackfire

apt install -y wget gnupg2
wget -q -O - https://packages.blackfire.io/gpg.key | apt-key add -
echo "deb http://packages.blackfire.io/debian any main" > /etc/apt/sources.list.d/blackfire.list
apt update -y
apt install -y blackfire-php
15 changes: 15 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3'

services:
test:
tty: true
privileged: true
build: .
image: defer-php-test
container_name: defer-php
hostname: defer-php-test
volumes:
- ..:/home/defer-php
environment:
- APP_ENV=local
working_dir: /home/defer-php
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; This file is for unifying the coding style for different editors and IDEs.
; More information at http://editorconfig.org

root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
13 changes: 11 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
* text=auto
/public/* -diff -merge
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/.scrutinizer.yml export-ignore
/tests export-ignore
/.editorconfig export-ignore
42 changes: 27 additions & 15 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
<?php

/**
* A PHP helper class to efficiently defer JavaScript for your website.
* (c) 2019 AppSeeds https://appseeds.net/
* Defer.php aims to help you concentrate on web performance optimization.
* (c) 2021 AppSeeds https://appseeds.net/
*
* @package shinsenter/defer.php
* @since 1.0.0
* PHP Version >=5.6
*
* @category Web_Performance_Optimization
* @package AppSeeds
* @author Mai Nhut Tan <shin@shin.company>
* @copyright 2019 AppSeeds
* @see https://github.com/shinsenter/defer.php/blob/develop/README.md
* @copyright 2021 AppSeeds
* @license https://code.shin.company/defer.php/blob/master/LICENSE MIT
* @link https://code.shin.company/defer.php
* @see https://code.shin.company/defer.php/blob/master/README.md
*/

$header = <<<'EOF'
A PHP helper class to efficiently defer JavaScript for your website.
(c) 2019 AppSeeds https://appseeds.net/
Defer.php aims to help you concentrate on web performance optimization.
(c) 2021 AppSeeds https://appseeds.net/
PHP Version >=5.6
@package shinsenter/defer.php
@since 1.0.0
@category Web_Performance_Optimization
@package AppSeeds
@author Mai Nhut Tan <shin@shin.company>
@copyright 2019 AppSeeds
@see https://github.com/shinsenter/defer.php/blob/develop/README.md
@copyright 2021 AppSeeds
@license https://code.shin.company/defer.php/blob/master/LICENSE MIT
@link https://code.shin.company/defer.php
@see https://code.shin.company/defer.php/blob/master/README.md
EOF;

$rules = [
Expand Down Expand Up @@ -92,12 +100,16 @@ $rules = [
];

$finder = \PhpCsFixer\Finder::create()
->in(__DIR__)
->in(__DIR__ . DIRECTORY_SEPARATOR)
->name('*.php')
->exclude('.idea')
->exclude('.docker')
->exclude('.ppm')
->exclude('assets')
->exclude('cache')
->exclude('vendor')
->exclude('patches')
->exclude('public')
->exclude('tests/v1')
->exclude('v1')
->ignoreDotFiles(true)
->ignoreVCS(true);

Expand Down
27 changes: 0 additions & 27 deletions .uglifyjs

This file was deleted.

8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to `shinsenter/defer.php` will be documented in this file.

## 2.0.0

- Changed namespace and API
- Optimized HTML processing performance
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing

Contributions are **welcome** and will be fully **credited**.

Please read and understand the contribution guide before creating an issue or pull request.

## Etiquette

This project is open source, and as such, the maintainers give their free time to build and maintain the source code
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
extremely unfair for them to suffer abuse or anger for their hard work.

Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
world that developers are civilized and selfless people.

It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
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.

## Viability

When requesting or submitting new features, first consider whether it might be useful to others. Open
source projects are used by many developers, who may have entirely different needs to your own. Think about
whether or not your feature is likely to be used by other users of the project.

## Procedure

Before filing an issue:

- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
- Check to make sure your feature suggestion isn't already present within the project.
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
- Check the pull requests tab to ensure that the feature isn't already in progress.

Before submitting a pull request:

- Check the codebase to ensure that your feature doesn't already exist.
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.

## Requirements

If the project maintainer has any additional requirements, you will find them listed here.

- **[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).

- **Add tests!** - Your patch won't be accepted if it doesn't have tests.

- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

- **Consider our release cycle** - We try to follow [SemVer v2.0.0](https://semver.org/). Randomly breaking public APIs is not an option.

- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.

- **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.

**Happy coding**!
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2019 Shin
Copyright (c) 2019 AppSeeds

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

0 comments on commit abc844b

Please sign in to comment.