Skip to content

Commit

Permalink
More meta files added. Automatic code style fixer added.
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed Jun 23, 2016
1 parent 6314c2d commit c3e7ddc
Show file tree
Hide file tree
Showing 9 changed files with 245 additions and 73 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor
composer.phar
composer.lock
.php_cs.cache
64 changes: 64 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/cache')
->notPath('storage')
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

$fixers = [
'-psr0',
'-php_closing_tag',
'blankline_after_open_tag',
'-concat_without_spaces',
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'include',
'join_function',
'list_commas',
'multiline_array_trailing_comma',
'namespace_no_leading_whitespace',
'newline_after_open_tag',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'phpdoc_indent',
'phpdoc_no_access',
'-phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'-phpdoc_var_without_name',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trim_array_spaces',
'unalign_equals',
'unary_operators_spaces',
'whitespacy_lines',
'multiline_spaces_before_semicolon',
'short_array_syntax',
'-short_echo_tag',
];

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers($fixers)
->finder($finder)
->setUsingCache(true);
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributing to Yii2 Google Analytics Tracking

Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

## Workflow

- Fork the project.
- Make your bug fix or feature addition.
- Add tests for it. This is important so we don't break it in a future version unintentionally.
- Send a pull request. Bonus points for topic branches.

Please make sure that you have [set up your user name and email address](http://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git.

Pull requests for bug fixes must be based on the current stable branch.

We are trying to keep backwards compatibility breaks in Yii2 Google Analytics Widget to an absolute minimum. Please take this into account when proposing changes.

Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us if you feel that we forgot to respond.

## Coding Guidelines

This project comes with a configuration file for php-cs-fixer (.php_cs) that you can use to (re)format your sourcecode for compliance with this project's coding guidelines:

```sh
vendor/bin/php-cs-fixer fix
```

## PHPUnit tests

The phpunit script can be used to invoke the PHPUnit test runner:

```sh
phpunit
```

## Reporting issues

- [General problems](https://github.com/cybercog/yii2-google-analytics/issues)
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Google Analytics extension for the Yii framework is free software.
It is released under the terms of the following BSD License.

Copyright © 2015, CyberCog LLC (http://cybercog.ru) All rights reserved.
Copyright © 2016, CyberCog LLC (http://cybercog.ru) All rights reserved.
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -27,4 +27,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64 changes: 27 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
# Google Analytics for Yii2
# Yii2 Google Analytics Tracking

[![Join the chat at https://gitter.im/cybercog/yii2-google-analytics](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cybercog/yii2-google-analytics?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Gitter chat at https://gitter.im/cybercog/yii2-google-analytics](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/cybercog/yii2-google-analytics?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Latest Stable Version](https://poser.pugx.org/cybercog/yii2-google-analytics/version)](https://packagist.org/packages/cybercog/yii2-google-analytics)
[![License](https://poser.pugx.org/cybercog/yii2-google-analytics/license)](https://github.com/cybercog/yii2-google-analytics/blob/master/LICENSE)

This extension provides easy way to add Universal Analytics tracking in your Yii2 application.

## Installation

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run
Run in console

```bash
$ php composer.phar require cybercog/yii2-google-analytics "~0.2"
php composer.phar require cybercog/yii2-google-analytics
```

or add

```json
"cybercog/yii2-google-analytics": "~0.2"
```

to the require section of your `composer.json` file.

## Usage

In your `/views/layouts/main.php` add
Expand All @@ -33,11 +27,9 @@ use cybercog\yii\googleanalytics\widgets\GATracking;
Then before `</head>` add following code

```php
<?= GATracking::widget(
[
'trackingId' => 'UA-XXXXXXXX-X'
]
) ?>
<?= GATracking::widget([
'trackingId' => 'UA-XXXXXXXX-X',
]) ?>
```

## Advanced usage
Expand All @@ -64,7 +56,7 @@ But sometimes we need the output without `script` tag to combined with `register
<?= $this->registerJs(
GATracking::widget([
'trackingId' => 'UA-XXXXXXXX-X',
'omitScriptTag' => true
'omitScriptTag' => true,
]), \yii\web\View::POS_END
); ?>
```
Expand All @@ -74,26 +66,24 @@ But sometimes we need the output without `script` tag to combined with `register
You can configure tracking script for your needs:

```php
<?= GATracking::widget(
[
'trackingId' => 'UA-XXXXXXXX-X',
'trackingConfig' => [
'name' => 'myTracker',
'allowAnchor' => false
<?= GATracking::widget([
'trackingId' => 'UA-XXXXXXXX-X',
'trackingConfig' => [
'name' => 'myTracker',
'allowAnchor' => false,
],
'omitScriptTag' => false,
'debug' => true,
'debugTrace' => true,
'anonymizeIp' => true,
'plugins' => [
'linkid' => [
'cookieName' => '_ccli',
'duration' => 45,
'levels' => 5,
],
'omitScriptTag' => false,
'debug' => true,
'debugTrace' => true,
'anonymizeIp' => true,
'plugins' => [
'linkid' => [
'cookieName' => '_ccli',
'duration' => 45,
'levels' => 5
]
]
]
) ?>
],
]) ?>
```

## Available fields (parameters)
Expand Down
49 changes: 26 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"name": "cybercog/yii2-google-analytics",
"description": "Google Analytics extension for the Yii2 framework",
"keywords": [
"yii2",
"google",
"analytics"
],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Anton Komarev",
"email": "[email protected]"
"name": "cybercog/yii2-google-analytics",
"description": "Google Analytics Widget for the Yii2 framework",
"keywords": [
"yii2",
"google",
"analytics"
],
"type": "yii2-extension",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Anton Komarev",
"email": "[email protected]"
}
],
"require": {
"yiisoft/yii2": "*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^1.11"
},
"autoload": {
"psr-4": {
"cybercog\\yii\\googleanalytics\\": "src"
}
}
],
"require": {
"yiisoft/yii2": "*"
},
"autoload": {
"psr-4": {
"cybercog\\yii\\googleanalytics\\": "src"
}
}
}
}
Loading

0 comments on commit c3e7ddc

Please sign in to comment.