Skip to content

Commit

Permalink
First Commit 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Jan 2, 2016
1 parent a3d6b8a commit 11bd0a4
Show file tree
Hide file tree
Showing 24 changed files with 671 additions and 74 deletions.
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
# editorconfig.org

root = true

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

[*.md]
indent_size = 2
25 changes: 8 additions & 17 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
/_docs export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpunit.xml export-ignore
63 changes: 6 additions & 57 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,6 @@
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

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows
# =========================

# 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
/.idea/
/_arcanedev/
/build/
/vendor/
/composer.phar
/composer.lock
35 changes: 35 additions & 0 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
filter:
excluded_paths: [tests/*, vendor/*]

checks:
php:
code_rating: true
duplication: true
remove_extra_empty_lines: true
remove_php_closing_tag: true
remove_trailing_whitespace: true
fix_use_statements:
remove_unused: true
preserve_multiple: false
preserve_blanklines: true
order_alphabetically: true
fix_php_opening_tag: true
fix_linefeed: true
fix_line_ending: true
fix_identation_4spaces: true
fix_doc_comments: true

tools:
external_code_coverage:
timeout: 600
runs: 4
php_code_sniffer:
enabled: true
config:
standard: PSR2
filter:
paths: ['src']
php_loc:
enabled: true
php_cpd:
enabled: true
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: php

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false

before_script:
- travis_retry composer self-update
- travis_retry composer install --prefer-source --no-interaction

script:
- composer validate
- mkdir -p build/logs
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# CONTRIBUTING

Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests.

## Guidelines

* Please follow the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) Coding Standard, PHP-FIG Naming Conventions and the [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) autoloading standard
* Ensure that the current tests pass, and if you've added something new, add the tests where relevant.
* Remember that we follow SemVer. If you are changing the behaviour, or the public api, you may need to update the docs.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
* You may also need to rebase to avoid merge conflicts.

## Running Tests

You will need an install of [Composer](https://getcomposer.org) before continuing.

First, install the dependencies:

```bash
$ composer install
```

Then run phpunit:

```bash
$ vendor/bin/phpunit
```

If the test suite passes on your local machine you should be good to go.

When you make a pull request, the tests will automatically be run again by [Travis CI](https://travis-ci.org/).
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015-2016 | ARCANEDEV <[email protected]> - Settings

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Settings [![Packagist License][badge_license]](LICENSE.md) [![For Laravel 5.1][badge_laravel]](https://github.com/ARCANESOFT/Settings#settings)

[![Travis Status][badge_build]](https://travis-ci.org/ARCANESOFT/Settings)
[![HHVM Status][badge_hhvm]](http://hhvm.h4cc.de/package/arcanesoft/settings)
[![Coverage Status][badge_coverage]](https://scrutinizer-ci.com/g/ARCANESOFT/Settings/?branch=master)
[![Scrutinizer Code Quality][badge_quality]](https://scrutinizer-ci.com/g/ARCANESOFT/Settings/?branch=master)
[![SensioLabs Insight][badge_insight]](https://insight.sensiolabs.com/projects/[id])
[![Github Issues][badge_issues]](https://github.com/ARCANESOFT/Settings/issues)

[![Packagist][badge_package]](https://packagist.org/packages/arcanesoft/settings)
[![Packagist Release][badge_release]](https://packagist.org/packages/arcanesoft/settings)
[![Packagist Downloads][badge_downloads]](https://packagist.org/packages/arcanesoft/settings)

[badge_license]: http://img.shields.io/packagist/l/arcanesoft/settings.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For-ARCANESOFT%20CMS-orange.svg?style=flat-square

[badge_build]: http://img.shields.io/travis/ARCANESOFT/Settings.svg?style=flat-square
[badge_hhvm]: https://img.shields.io/hhvm/arcanesoft/settings.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANESOFT/Settings.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/[id].svg?style=flat-square
[badge_issues]: http://img.shields.io/github/issues/ARCANESOFT/Settings.svg?style=flat-square

[badge_package]: https://img.shields.io/badge/package-arcanesoft/settings-blue.svg?style=flat-square
[badge_release]: https://img.shields.io/packagist/v/arcanesoft/settings.svg?style=flat-square
[badge_downloads]: https://img.shields.io/packagist/dt/arcanesoft/settings.svg?style=flat-square

*By [ARCANEDEV&copy;](http://www.arcanedev.net/)*

This package allow to have a persistent settings.

Official documentation for Settings package can be found at the [Docs folder](_docs).

Feel free to check out the [releases](https://github.com/ARCANESOFT/Settings/releases), [license](LICENSE.md), and [contribution guidelines](CONTRIBUTING.md).

### Features

* Easy setup & configuration.
* Well documented &amp; IDE Friendly.
* Well tested with maximum code quality.
* Made with :heart: &amp; :coffee:.

## Table of contents

1. [Requirements](_docs/1-Requirements.md)
2. [Installation and Setup](_docs/2-Installation-and-Setup.md)
3. [Configuration](_docs/3-Configuration.md)
4. [Usage](_docs/4-Usage.md)

### TODOS

- [ ] 100% Code coverage + Maximum code quality.
- [ ] Laravel 5.2 support.
- [ ] Laravel 5.1 supported.

## Contribution

Any ideas are welcome. Feel free to submit any issues or pull requests, please check the [contribution guidelines](CONTRIBUTING.md).
Empty file added _docs/0-Home.md
Empty file.
Empty file added _docs/1-Requirements.md
Empty file.
Empty file.
Empty file added _docs/3-Configuration.md
Empty file.
Empty file added _docs/4-Usage.md
Empty file.
41 changes: 41 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "arcanesoft/settings",
"description": "Persistent settings for Laravel & ARCANESOFT CMS.",
"keywords": ["arcanedev", "arcanesoft", "laravel", "setting", "settings", "config", "persistent"],
"homepage": "https://github.com/ARCANESOFT/Settings",
"authors": [
{
"name": "ARCANEDEV",
"email": "[email protected]",
"homepage": "https://github.com/arcanedev-maroc",
"role": "Developer"
}
],
"type": "library",
"license": "MIT",
"require": {
"php" : ">=5.5.9",
"arcanedev/support": "~3.0"
},
"require-dev": {
"orchestra/testbench": "~3.1.0",
"phpunit/phpcov": "~2.0",
"phpunit/phpunit": "~4.0|~5.0"
},
"autoload": {
"psr-4": {
"Arcanesoft\\Settings\\": "src/"
},
"files": ["helpers.php"]
},
"autoload-dev": {
"psr-4": {
"Arcanesoft\\Settings\\Tests\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}
15 changes: 15 additions & 0 deletions config/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

return [
/* ------------------------------------------------------------------------------------------------
| Settings
| ------------------------------------------------------------------------------------------------
*/
'default-domain' => 'default',

'database' => [
'connection' => null,
'table' => 'settings',
'model' => \Arcanesoft\Settings\Models\Setting::class,
],
];
47 changes: 47 additions & 0 deletions database/migrations/2015_00_00_000000_create_settings_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

use Arcanedev\Support\Bases\Migration;
use Illuminate\Database\Schema\Blueprint;

/**
* Class CreateSettingsTable
*
* @author ARCANEDEV <[email protected]>
*/
class CreateSettingsTable extends Migration
{
/* ------------------------------------------------------------------------------------------------
| Constructor
| ------------------------------------------------------------------------------------------------
*/
/**
* CreateSettingsTable constructor.
*/
public function __construct()
{
$configs = config('arcanesoft.settings.database');
$this->connection = array_get($configs, 'connection', null);
$this->table = array_get($configs, 'table', 'settings');
}

/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
/**
* {@inheritdoc}
*/
public function up()
{
$this->createSchema(function(Blueprint $table) {
$table->increments('id');

$table->string('domain')->nullable();
$table->string('key');
$table->text('value');
$table->enum('type', ['integer', 'real', 'float', 'double', 'string', 'boolean', 'object', 'array']);

$table->timestamps();
});
}
}
13 changes: 13 additions & 0 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

if ( ! function_exists('settings')) {
/**
* Get the SettingManager instance.
*
* @return \Arcanesoft\Settings\SettingsManager
*/
function settings()
{
return app('arcanesoft.settings.manager');
}
}
Loading

0 comments on commit 11bd0a4

Please sign in to comment.