Skip to content

Commit

Permalink
Merge pull request #3 from vdhicts/feature/update-php8
Browse files Browse the repository at this point in the history
Update to PHP 8+
  • Loading branch information
dvdheiden authored Mar 6, 2022
2 parents 4b1013c + eb339ce commit 308e1d5
Show file tree
Hide file tree
Showing 13 changed files with 1,256 additions and 634 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: bug
assignees: dvdheiden

---

## Describe the bug

A clear and concise description of what the bug is.

## Reproduction

Steps to reproduce the behavior.

## Expected behavior

A clear and concise description of what you expected to happen.

## Actual behavior

Describe the behavior as it is right now.

## Additional information

Anything else you want to provide.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: feature
assignees: dvdheiden

---

## Goal

A clear and concise description of what the problem is. Ex. I think this could be easier when...

## Additional information

Add any other context or screenshots about the feature request here.
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changes

Provide a summary of your changes.

# Checks

- [ ] The changelog is updated (when applicable)
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: HtmlElement

on: [push]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']

name: PHP ${{ matrix.php-versions }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-suggest --no-progress

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: |
vendor/bin/phpunit
- name: Execute static analysis
run: |
vendor/bin/phpstan
155 changes: 5 additions & 150 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,150 +1,5 @@
# Based on https://github.com/github/gitignore/tree/master/Global

################################################################################
#
# Ignore all dot-files and dot-folders, except .htaccess and .gitignore
#
################################################################################
.*
!/.gitignore
!/.htaccess

################################################################################
#
# JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
#
################################################################################
*.iml
.idea/

## File-based project format:
*.ipr
*.iws

# Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties

################################################################################
#
# Netbeans
#
################################################################################

nbproject/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/

################################################################################
#
# Windows OS
#
################################################################################

# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

################################################################################
#
# Notepad++
#
################################################################################

*.bak

################################################################################
#
# Vagrant
#
################################################################################

.vagrant/

################################################################################
#
# TortoiseGit
#
################################################################################

# Project-level settings
/.tgitconfig

################################################################################
#
# NodeJS
#
################################################################################

# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules

################################################################################
#
# Composer
#
################################################################################

composer.phar
vendor/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
composer.lock
/vendor/
/.idea/
/build/
.phpunit.result.cache
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@
This package allows you to easily create HTML elements from PHP. It's inspired by
[David Walsh's blogpost](https://davidwalsh.name/create-html-elements-php-htmlelement-class) but further improved.

```$php
use Vdhicts\Dicms\Html;
```php
use Vdhicts\HtmlElement\HtmlElement;

// Create new html element with attribute name
$selectElement = new Html\Element('select');
$selectElement = new HtmlElement('select');
$selectElement->setAttribute('name', 'something');
$selectElement->generate();

// Create new html element with text and attribute
$paragraphElement = new Html\Element('p', 'text', ['class' => 'center']);
$paragraphElement = new HtmlElement('p', 'text', ['class' => 'center']);
```

## Requirements

This package requires PHP 7.
This package requires PHP 7.4 or higher.

## Installation

This package can be used in any PHP project or with any framework. The packages is tested in PHP 5.6 and PHP 7.0.

You can install the package via composer:

``` bash
Expand All @@ -35,7 +32,9 @@ composer require vdhicts/html-element
A new html element can be created with:

```php
$containerElement = new Html\Element('div');
use Vdhicts\HtmlElement\HtmlElement;

$containerElement = new HtmlElement('div');
$containerElement->setAttribute('class', 'container');
```

Expand All @@ -58,8 +57,8 @@ $containerElement->setAttributes(['class' => 'container', 'role' => 'container']
Or the element could contain another html element:

```php
$colElement = new Html\Element('div', '', ['class' => 'col-md-6']);
$rowElement = new Html\Element('div', '', ['class' => 'row']);
$colElement = new HtmlElement('div', '', ['class' => 'col-md-6']);
$rowElement = new HtmlElement('div', '', ['class' => 'row']);

$rowElement->inject($colElement);
$containerElement->inject($rowElement);
Expand All @@ -83,28 +82,33 @@ value

## Tests

Full code coverage unit tests are available in the `tests` folder. Run via phpunit:
Unit tests are available in the `tests` folder. Run with:

`vendor\bin\phpunit`
`composer test`

By default a coverage report will be generated in the `build/coverage` folder.
When you want a code coverage report which will be generated in the `build/report` folder. Run with:

`composer test-coverage`

## Contribution

Any contribution is welcome, but it should be fully tested, meet the PSR-2 standard and please create one pull request
per feature. In exchange you will be credited as contributor on this page.
Any contribution is welcome, but it should meet the PSR-12 standard and please create one pull request per feature/bug.
In exchange, you will be credited as contributor on this page.

## Security

If you discover any security related issues in this or other packages of Vdhicts, please email [email protected] instead
of using the issue tracker.
If you discover any security related issues in this or other packages of Vdhicts, please email [email protected]
instead of using the issue tracker.

## Support

If you encounter a problem with this parser or has a question about it, feel free to open an issue on GitHub.

## License

This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

## About vdhicts
## About Vdhicts

[Van der Heiden ICT services](https://www.vdhicts.nl) is the name of my personal company for which I work as
freelancer. Van der Heiden ICT services develops and implements IT solutions for businesses and educational
institutions.
[Vdhicts](https://www.vdhicts.nl) is the name of my personal company for which I work as freelancer. Vdhicts develops
and implements IT solutions for businesses and educational institutions.
26 changes: 22 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,30 @@
}
],
"require": {
"php": "^7.0"
"php": "^7.4|^8.0"
},
"require-dev": {
"phpunit/phpunit": "^6.1"
"phpstan/phpstan": "^1.2",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {"Vdhicts\\Dicms\\Html\\": "src/"}
}
"psr-4": {
"Vdhicts\\HtmlElement\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Vdhicts\\HtmlElement\\Tests\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit --no-coverage",
"test-coverage": "vendor/bin/phpunit",
"analyse": "vendor/bin/phpstan"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit 308e1d5

Please sign in to comment.