Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.0.3'
Browse files Browse the repository at this point in the history
* release/v0.0.3: (31 commits)
  Update changelog
  Remove not-existing validation rule usage (fix #12)
  Fix minor readme typos
  Drop Laravel 5.5 support
  Update composer packages
  Update composer packages
  Add force option to artisan commands
  Simplify IoC binding
  Update minimum required PHP version
  Add Laravel v5.6 support
  Drop useless model contracts (models already swappable through IoC)
  Typehint void method returns
  Tweak composer file
  Require PHP 7.1.0 at least
  Simplify reamde
  Remove unused namespace
  Add composer dependency roave/security-advisories
  Add PHPUnitPrettyResultPrinter
  Enforce consistency
  Add missing composer dependencies
  ...
  • Loading branch information
Omranic committed Feb 18, 2018
2 parents c3fa535 + 52b66b7 commit 3cb5f1e
Show file tree
Hide file tree
Showing 15 changed files with 190 additions and 173 deletions.
9 changes: 5 additions & 4 deletions .gitattributes
@@ -1,8 +1,9 @@
* text=auto
*.js linguist-vendored
*.css linguist-vendored
*.scss linguist-vendored

phpunit.* export-ignore
phpcs.* export-ignore
tests export-ignore
.* export-ignore
/phpunit.* export-ignore
/phpcs.* export-ignore
/tests export-ignore
/.* export-ignore
49 changes: 31 additions & 18 deletions .styleci.yml
@@ -1,20 +1,33 @@
preset: recommended
php:
preset: recommended

enabled:
- dir_constant
- ereg_to_preg
- mb_str_functions
- no_short_echo_tag
- strict_comparison
- phpdoc_link_to_see
- no_php4_constructor
- declare_strict_types
- unalign_double_arrow
- length_ordered_imports
- modernize_types_casting
- return_type_declaration
- not_operator_with_successor_space
enabled:
- dir_constant
- ereg_to_preg
- mb_str_functions
- no_short_echo_tag
- strict_comparison
- phpdoc_link_to_see
- no_php4_constructor
- declare_strict_types
- unalign_double_arrow
- length_ordered_imports
- modernize_types_casting
- return_type_declaration
- not_operator_with_successor_space

disabled:
- align_double_arrow
- alpha_ordered_imports
disabled:
- align_double_arrow
- alpha_ordered_imports

js:
tab-width: 4
print-width: 120

ts:
tab-width: 4
print-width: 120

css:
tab-width: 4
print-width: 120
17 changes: 16 additions & 1 deletion CHANGELOG.md
Expand Up @@ -5,11 +5,26 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](CONTRIBUTING.md).


## [v0.0.3] - 2018-02-18
- Update supplementary files
- Update composer dependencies
- Add PublishCommand to artisan
- Add Rollback Console Command
- Add PHPUnitPrettyResultPrinter
- Require PHP v7.1.3
- Typehint method returns
- Drop useless model contracts (models already swappable through IoC)
- Add Laravel v5.6 support
- Simplify IoC binding
- Add force option to artisan commands
- Drop Laravel 5.5 support

## [v0.0.2] - 2017-09-08
- Fix many issues and apply many enhancements
- Rename package rinvex/addresses from rinvex/addressable

## v0.0.1 - 2017-04-07
- Commit first draft
- Tag first release

[v0.0.3]: https://github.com/rinvex/addresses/compare/v0.0.2...v0.0.3
[v0.0.2]: https://github.com/rinvex/addresses/compare/v0.0.1...v0.0.2
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2017, Rinvex LLC,
Copyright (c) 2016-2018, Rinvex LLC,

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
35 changes: 10 additions & 25 deletions README.md
Expand Up @@ -3,11 +3,9 @@
**Rinvex Addresses** is a polymorphic Laravel package, for addressbook management. You can add addresses to any eloquent model with ease.

[![Packagist](https://img.shields.io/packagist/v/rinvex/addresses.svg?label=Packagist&style=flat-square)](https://packagist.org/packages/rinvex/addresses)
[![VersionEye Dependencies](https://img.shields.io/versioneye/d/php/rinvex:addresses.svg?label=Dependencies&style=flat-square)](https://www.versioneye.com/php/rinvex:addresses/)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/rinvex/addresses.svg?label=Scrutinizer&style=flat-square)](https://scrutinizer-ci.com/g/rinvex/addresses/)
[![Code Climate](https://img.shields.io/codeclimate/github/rinvex/addresses.svg?label=CodeClimate&style=flat-square)](https://codeclimate.com/github/rinvex/addresses)
[![Travis](https://img.shields.io/travis/rinvex/addresses.svg?label=TravisCI&style=flat-square)](https://travis-ci.org/rinvex/addresses)
[![SensioLabs Insight](https://img.shields.io/sensiolabs/i/8a185d9d-f23a-4782-b71c-aa35ee74d385.svg?label=SensioLabs&style=flat-square)](https://insight.sensiolabs.com/projects/8a185d9d-f23a-4782-b71c-aa35ee74d385)
[![StyleCI](https://styleci.io/repos/87485079/shield)](https://styleci.io/repos/87485079)
[![License](https://img.shields.io/packagist/l/rinvex/addresses.svg?label=License&style=flat-square)](https://github.com/rinvex/addresses/blob/develop/LICENSE)

Expand All @@ -29,26 +27,13 @@

## Usage

### Create Your Model
To add addresses support to your eloquent models simply use `\Rinvex\Addresses\Traits\Addressable` trait.

Simply create a new eloquent model, and use `\Rinvex\Addresses\Traits\Addressable` trait:
### Manage your addresses

```php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Rinvex\Addresses\Traits\Addressable;

class User extends Model
{
use Addressable;
}
```

### Manage Your Addresses

```php
$user = new \App\Models\User();
// Get instance of your model
$user = new \App\Models\User::find(1);

// Create a new address
$user->addresses()->create([
Expand All @@ -63,7 +48,7 @@ $user->addresses()->create([
'street' => '56 john doe st.',
'state' => 'Alexandria',
'city' => 'Alexandria',
'useral_code' => '21614',
'postal_code' => '21614',
'lat' => '31.2467601',
'lng' => '29.9020376',
'is_primary' => true,
Expand Down Expand Up @@ -93,13 +78,13 @@ $address->delete();
$user->addresses()->where('id', 123)->first()->delete();
```

### Manage Your Addressable Model
### Manage your addressable model

The API is intutive and very straightfarwad, so let's give it a quick look:
The API is intuitive and very straight forward, so let's give it a quick look:

```php
// Instantiate your model
$user = new \App\Models\User();
// Get instance of your model
$user = new \App\Models\User::find(1);

// Get attached addresses collection
$user->addresses;
Expand Down Expand Up @@ -169,4 +154,4 @@ Rinvex is a software solutions startup, specialized in integrated enterprise sol

This software is released under [The MIT License (MIT)](LICENSE).

(c) 2016-2017 Rinvex LLC, Some rights reserved.
(c) 2016-2018 Rinvex LLC, Some rights reserved.
19 changes: 11 additions & 8 deletions composer.json
Expand Up @@ -46,15 +46,18 @@
}
],
"require": {
"php": "^7.0.0",
"php": "^7.1.3",
"illuminate/console": "~5.6.0",
"illuminate/database": "~5.6.0",
"illuminate/support": "~5.6.0",
"jackpopp/geodistance": "^1.2",
"illuminate/support": "~5.5.0",
"illuminate/database": "~5.5.0",
"rinvex/cacheable": "dev-develop"
"rinvex/cacheable": "dev-develop",
"rinvex/support": "dev-develop"
},
"require-dev": {
"phpunit/phpunit": "^6.0.0",
"illuminate/container": "~5.5.0"
"codedungeon/phpunit-result-printer": "^0.6.0",
"illuminate/container": "~5.6.0",
"phpunit/phpunit": "^7.0.0"
},
"autoload": {
"classmap": [
Expand All @@ -66,12 +69,12 @@
},
"autoload-dev": {
"psr-4": {
"Rinvex\\Addresses\\Test\\": "tests"
"Rinvex\\Addresses\\Tests\\": "tests"
}
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"preferred-install": "dist",
"optimize-autoloader": true
},
"extra": {
Expand Down
13 changes: 7 additions & 6 deletions phpunit.xml.dist
Expand Up @@ -11,7 +11,8 @@
stopOnFailure="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutChangesToGlobalState="true"
beStrictAboutCoversAnnotation="true">
beStrictAboutCoversAnnotation="true"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer">
<testsuites>
<testsuite name="Rinvex Addresses Unit Test Suite">
<directory>tests</directory>
Expand All @@ -23,10 +24,10 @@
</whitelist>
</filter>
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="tap" target="build/report.tap" />
<log type="junit" target="build/report.junit.xml" />
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true" />
<log type="coverage-text" target="build/coverage.txt" />
<log type="coverage-clover" target="build/logs/clover.xml" />
</logging>
</phpunit>
8 changes: 4 additions & 4 deletions src/Console/Commands/MigrateCommand.php
Expand Up @@ -13,7 +13,7 @@ class MigrateCommand extends Command
*
* @var string
*/
protected $signature = 'rinvex:migrate:addresses';
protected $signature = 'rinvex:migrate:addresses {--force : Force the operation to run when in production.}';

/**
* The console command description.
Expand All @@ -27,9 +27,9 @@ class MigrateCommand extends Command
*
* @return void
*/
public function handle()
public function handle(): void
{
$this->warn('Migrate rinvex/addresses:');
$this->call('migrate', ['--step' => true, '--path' => 'vendor/rinvex/addresses/database/migrations']);
$this->warn($this->description);
$this->call('migrate', ['--step' => true, '--path' => 'vendor/rinvex/addresses/database/migrations', '--force' => $this->option('force')]);
}
}
35 changes: 35 additions & 0 deletions src/Console/Commands/PublishCommand.php
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Rinvex\Addresses\Console\Commands;

use Illuminate\Console\Command;

class PublishCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rinvex:publish:addresses {--force : Overwrite any existing files.}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Publish Rinvex Addresses Resources.';

/**
* Execute the console command.
*
* @return void
*/
public function handle(): void
{
$this->warn($this->description);
$this->call('vendor:publish', ['--tag' => 'rinvex-addresses-config', '--force' => $this->option('force')]);
}
}
35 changes: 35 additions & 0 deletions src/Console/Commands/RollbackCommand.php
@@ -0,0 +1,35 @@
<?php

declare(strict_types=1);

namespace Rinvex\Addresses\Console\Commands;

use Illuminate\Console\Command;

class RollbackCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rinvex:rollback:addresses {--force : Force the operation to run when in production.}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Rollback Rinvex Addresses Tables.';

/**
* Execute the console command.
*
* @return void
*/
public function handle(): void
{
$this->warn($this->description);
$this->call('migrate:reset', ['--path' => 'vendor/rinvex/addresses/database/migrations', '--force' => $this->option('force')]);
}
}

0 comments on commit 3cb5f1e

Please sign in to comment.