Skip to content

Commit 103c6f4

Browse files
authored
Initial commit
0 parents  commit 103c6f4

26 files changed

+615
-0
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: :package_name
2+
custom: ['url']

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/vendor
2+
node_modules/
3+
npm-debug.log
4+
yarn-error.log
5+
composer.lock
6+
*.meta.*
7+
_ide_*
8+
.phpunit.result.cache
9+

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Changelog
2+
3+
All notable changes to `vendor/package` will be documented in this file.
4+
5+
### 0.1.1 - 2021-12-02
6+
7+
#### Added
8+
9+
#### Edited
10+
11+
#### Fixed

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
- [![Starts](https://img.shields.io/github/stars/miladimos/package-skeleton?style=flat&logo=github)](https://github.com/miladimos/package-skeleton/forks)
2+
- [![Forks](https://img.shields.io/github/forks/miladimos/package-skeleton?style=flat&logo=github)](https://github.com/miladimos/package-skeleton/stargazers)
3+
[![Total Downloads](https://img.shields.io/packagist/dt/miladimos/package-skeleton.svg?style=flat-square)](https://packagist.org/packages/miladimos/package-skeleton)
4+
5+
6+
# vendor/package
7+
8+
A package for fun
9+
10+
### Installation
11+
12+
1. Run the command below to add this package:
13+
14+
```
15+
composer require vendor/package
16+
```
17+
18+
2. Open your config/app.php and add the following to the providers array:
19+
20+
```php
21+
Vendor\Package\Providers\CacheableServiceProvider::class,
22+
```
23+
24+
1. Run the command below to install the package:
25+
26+
```
27+
php artisan package:install
28+
```
29+
30+
31+
## Testing
32+
33+
```bash
34+
composer test
35+
```
36+
37+
## Changelog
38+
39+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
40+
41+
## Contributing
42+
43+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
44+
45+
## Credits
46+
47+
- [:author_name](https://github.com/:author_username)
48+
- [All Contributors](../../contributors)
49+
50+
## License
51+
52+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "miladimos/package-skeleton",
3+
"description": "test description",
4+
"homepage": "https://github.com/miladimos/package-skeleton",
5+
"type": "library",
6+
"version": "0.1.0",
7+
"keywords": [
8+
"laravel",
9+
"laravel-package",
10+
"laravel support",
11+
"lumen packages",
12+
"laravel packages",
13+
"lumen support"
14+
],
15+
"authors": [
16+
{
17+
"name": "miladimos",
18+
"email": "[email protected]",
19+
"role": "maintainer",
20+
"homepage": "https://github.com/miladimos"
21+
}
22+
],
23+
"autoload": {
24+
"psr-4": {
25+
"Vendor\\Package\\": "src/"
26+
},
27+
"files": [
28+
"./src/helpers.php"
29+
]
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"Vendor\\Package\\Tests\\": "tests"
34+
}
35+
},
36+
"extra": {
37+
"laravel": {
38+
"providers": [
39+
"Package\\Package\\Providers\\PackageServiceProvider"
40+
],
41+
"aliases": {
42+
"Package": "Vendor\\Package\\Facades\\Package"
43+
}
44+
}
45+
},
46+
"require": {
47+
"php": ">=7.4|^8.0"
48+
},
49+
"require-dev": {
50+
"phpunit/phpunit": "^9.4"
51+
},
52+
"minimum-stability": "stable",
53+
"license": "MIT"
54+
}

config/config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
// config file for vendor/package
4+
return [
5+
//
6+
];
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class CreateTablesTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::create('tables', function (Blueprint $table) {
17+
$table->id();
18+
19+
$table->string('title');
20+
21+
$table->timestamps();
22+
});
23+
}
24+
25+
/**
26+
* Reverse the migrations.
27+
*
28+
* @return void
29+
*/
30+
public function down()
31+
{
32+
Schema::dropIfExists('tables');
33+
}
34+
}

phpunit.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<php>
23+
<env name="DB_CONNECTION" value="testing"/>
24+
</php>
25+
</phpunit>

resources/.gitkeep

Whitespace-only changes.

routes/package.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
// routes of vendor/package
4+
5+
use Illuminate\Support\Facades\Route;
6+
7+
Route::group([], function () {
8+
// Route::get('package', [PackageController::class => 'index']);
9+
});
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
<?php
2+
3+
namespace Vendor\Package\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
7+
class InstallPackageCommand extends Command
8+
{
9+
protected $signature = 'package:install';
10+
11+
protected $description = 'Install the package Package';
12+
13+
public function handle()
14+
{
15+
$this->line("\t... Welcome To Package Installer ...");
16+
17+
18+
// if (!empty(File::glob(database_path('migrations\*_create_packages_tables.php')))) {
19+
20+
// $list = File::glob(database_path('migrations\*_create_packages_tables.php'));
21+
// collect($list)->each(function ($item) {
22+
// File::delete($item);
23+
// });
24+
25+
// $this->publishMigration();
26+
// } else {
27+
// $this->publishMigration();
28+
// }
29+
30+
// if (!empty(File::glob(database_path('migrations\*_create_package_table.php')))) {
31+
// $list = File::glob(database_path('migrations\*_create_package_table.php'));
32+
// collect($list)->each(function ($item) {
33+
// File::delete($item);
34+
// $this->warn("Deleted: " . $item);
35+
// });
36+
// $this->publishMigration();
37+
// } else {
38+
// $this->publishMigration();
39+
// }
40+
41+
$this->info("Package Successfully Installed.\n");
42+
$this->info("\t\tGood Luck.");
43+
}
44+
45+
// //config
46+
// if (File::exists(config_path('package.php'))) {
47+
// $confirm = $this->confirm("package.php already exist. Do you want to overwrite?");
48+
// if ($confirm) {
49+
// $this->publishConfig();
50+
// $this->info("config overwrite finished");
51+
// } else {
52+
// $this->info("skipped config publish");
53+
// }
54+
// } else {
55+
// $this->publishConfig();
56+
// $this->info("config published");
57+
// }
58+
59+
// //assets
60+
// if (File::exists(public_path('package'))) {
61+
// $confirm = $this->confirm("package directory already exist. Do you want to overwrite?");
62+
// if ($confirm) {
63+
// $this->publishAssets();
64+
// $this->info("assets overwrite finished");
65+
// } else {
66+
// $this->info("skipped assets publish");
67+
// }
68+
// } else {
69+
// $this->publishAssets();
70+
// $this->info("assets published");
71+
// }
72+
73+
// //migration
74+
// if (File::exists(database_path("migrations/$migrationFile"))) {
75+
// $confirm = $this->confirm("migration file already exist. Do you want to overwrite?");
76+
// if ($confirm) {
77+
// $this->publishMigration();
78+
// $this->info("migration overwrite finished");
79+
// } else {
80+
// $this->info("skipped migration publish");
81+
// }
82+
// } else {
83+
// $this->publishMigration();
84+
// $this->info("migration published");
85+
// }
86+
87+
// $this->call('migrate');
88+
// }
89+
90+
// private function publishConfig()
91+
// {
92+
// $this->call('vendor:publish', [
93+
// '--provider' => "Vendor\\Package\\Providers\\PackageServiceProvider",
94+
// '--tag' => 'package-config',
95+
// '--force' => true
96+
// ]);
97+
// }
98+
99+
// private function publishMigration()
100+
// {
101+
// $this->call('vendor:publish', [
102+
// '--provider' => "Vendor\\Package\\Providers\\PackageServiceProvider",
103+
// '--tag' => 'package-migrations',
104+
// '--force' => true
105+
// ]);
106+
// }
107+
108+
// private function publishAssets()
109+
// {
110+
// $this->call('vendor:publish', [
111+
// '--provider' => "Vendor\\Package\\Providers\\PackageServiceProvider",
112+
// '--tag' => 'package-assets',
113+
// '--force' => true
114+
// ]);
115+
// }
116+
}

src/Contracts/.gitkeep

Whitespace-only changes.

src/Facades/Package.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Vendor\Package\Facades;
4+
5+
use Illuminate\Support\Facades\Facade;
6+
7+
class Package extends Facade
8+
{
9+
protected static function getFacadeAccessor()
10+
{
11+
return 'package'; // TODO: Change the accessor name
12+
}
13+
}

src/Http/Controllers/Controller.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Vendor\Package\Http\Controllers;
4+
5+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
6+
use Illuminate\Foundation\Bus\DispatchesJobs;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Routing\Controller as BaseController;
9+
use Vendor\Package\Traits\ApiResponder;
10+
11+
class Controller extends BaseController
12+
{
13+
use AuthorizesRequests, DispatchesJobs, ValidatesRequests, ApiResponder;
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Vendor\Package\Http\Controllers;
4+
5+
use Illuminate\Container\Container;
6+
use Vendor\Package\Http\Controllers\Controller;
7+
8+
class PackageController extends Controller
9+
{
10+
public function index()
11+
{
12+
return true;
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Vendor\Package\Http\Middleware;
4+
5+
use Closure;
6+
use Illuminate\Http\Request;
7+
8+
class PackageMiddleware
9+
{
10+
public function handle(Request $request, Closure $next)
11+
{
12+
return $next($request);
13+
}
14+
}

0 commit comments

Comments
 (0)