-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from cslant/feature/First-generate-api-package-#1
Feature/first generate api package #1
- Loading branch information
Showing
15 changed files
with
308 additions
and
20 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,31 @@ | ||
/vendor/ | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
|
||
# Laravel 4 specific | ||
bootstrap/compiled.php | ||
app/storage/ | ||
|
||
# Laravel 5 & Lumen specific | ||
public/storage | ||
public/hot | ||
/vendor | ||
composer.lock | ||
composer.phar | ||
.DS_Store | ||
/node_modules | ||
/public/storage | ||
/storage/*.key | ||
Thumbs.db | ||
/bower_components | ||
|
||
# Laravel 5 & Lumen specific with changed public path | ||
public_html/storage | ||
public_html/hot | ||
|
||
storage/*.key | ||
.env | ||
.idea/ | ||
Homestead.yaml | ||
.env.backup | ||
.idea | ||
.vscode | ||
|
||
.vagrant | ||
Homestead.json | ||
/.vagrant | ||
Homestead.yaml | ||
npm-debug.log | ||
|
||
.phpunit.cache | ||
.phpunit.result.cache | ||
/storage/.license | ||
/storage/fonts | ||
/storage/installing | ||
/storage/installed | ||
/log | ||
build | ||
package-lock.json | ||
yarn.lock | ||
/.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
build: | ||
nodes: | ||
analysis: | ||
project_setup: | ||
override: true | ||
tests: | ||
override: [ php-scrutinizer-run ] | ||
environment: | ||
php: | ||
version: 8.0 | ||
|
||
checks: | ||
php: | ||
code_rating: 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: | ||
php_analyzer: true | ||
php_code_coverage: true | ||
php_code_sniffer: | ||
config: | ||
standard: PSR4 | ||
filter: | ||
paths: [ 'src' ] | ||
php_loc: | ||
enabled: true | ||
excluded_dirs: [ vendor ] | ||
php_cpd: | ||
enabled: true | ||
excluded_dirs: [ vendor ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
preset: laravel | ||
|
||
disabled: | ||
- not_operator_with_successor_space |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"name": "cslant/blog-api-package", | ||
"description": "Send notification from Gitlab and Github events to Telegram", | ||
"keywords": [ | ||
"cslant", | ||
"laravel", | ||
"cslant-blog-api-package", | ||
"cslant-blog-api", | ||
"cslant-blog", | ||
"cslant-api", | ||
"cslant-package", | ||
"blog-api-package" | ||
], | ||
"homepage": "https://github.com/cslant/blog-api-package", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Tan Nguyen", | ||
"email": "tannp27@gmail.com", | ||
"homepage": "https://tanhongit.com", | ||
"role": "Developer" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"CSlant\\BlogApi\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"CSlant\\BlogApi\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": "^8.1" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^v3.0", | ||
"nunomaduro/collision": "^7.10", | ||
"nunomaduro/larastan": "^2.9", | ||
"orchestra/testbench": "^8.0", | ||
"pestphp/pest": "^2.0", | ||
"phpstan/extension-installer": "^1.3", | ||
"phpstan/phpstan-deprecation-rules": "^1.1", | ||
"phpstan/phpstan-phpunit": "^1.3" | ||
}, | ||
"scripts": { | ||
"analyse": "vendor/bin/phpstan analyse", | ||
"format": "vendor/bin/php-cs-fixer fix --allow-risky=yes" | ||
}, | ||
"support": { | ||
"issues": "https://github.com/cslant/blog-api-package/issues" | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"CSlant\\BlogApi\\Providers\\BlogApiServiceProvider" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true, | ||
"allow-plugins": { | ||
"pestphp/pest-plugin": true, | ||
"phpstan/extension-installer": true | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
$routePrefix = env('BLOG_API_ROUTE_PREFIX', 'api'); | ||
|
||
return [ | ||
'defaults' => [ | ||
/* Set route prefix for the blog API */ | ||
'route_prefix' => $routePrefix, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'message' => 'Hello from the blog API!', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
parameters: | ||
ignoreErrors: | ||
- message: '#Parameter \#1 \$prefix of static method Illuminate\\Support\\Facades\\Route::prefix\(\) expects string, mixed given\.#' | ||
path: routes/blog-api.php | ||
|
||
- message: '#Part \$routePrefix \(mixed\) of encapsed string cannot be cast to string\.#' | ||
path: routes/blog-api.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 9 | ||
paths: | ||
- src | ||
- routes | ||
tmpDir: build/phpstan | ||
checkOctaneCompatibility: true | ||
checkModelProperties: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
colors="true" | ||
processIsolation="false" | ||
stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" | ||
cacheDirectory=".phpunit.cache" | ||
backupStaticProperties="false"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">src/</directory> | ||
</include> | ||
</coverage> | ||
<testsuites> | ||
<testsuite name="CSlant Blog API Package"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Blog API Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here is where you can register bot routes for your application. These | ||
| routes are loaded by the RouteServiceProvider and all of them will | ||
| be assigned to the "api" middleware group. Enjoy building your API! | ||
| | ||
*/ | ||
|
||
$routePrefix = config('blog-api.defaults.route_prefix'); | ||
|
||
Route::prefix($routePrefix)->name("$routePrefix.")->group(function () { | ||
Route::get('/hello', function () { | ||
return response()->json([ | ||
'message' => 'Hello from the blog API!', | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace CSlant\BlogApi\Models\Traits; | ||
|
||
trait IsIncrementing | ||
{ | ||
public $incrementing = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace CSlant\BlogApi\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class BlogApiServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot(): void | ||
{ | ||
$routePath = __DIR__.'/../../routes/blog-api.php'; | ||
if (file_exists($routePath)) { | ||
$this->loadRoutesFrom($routePath); | ||
} | ||
|
||
$this->loadTranslationsFrom(__DIR__.'/../../lang', 'blog-api'); | ||
|
||
$this->registerCommands(); | ||
|
||
$this->registerAssetPublishing(); | ||
} | ||
|
||
/** | ||
* Register services. | ||
* | ||
* @return void | ||
*/ | ||
public function register(): void | ||
{ | ||
$configPath = __DIR__.'/../../config/blog-api.php'; | ||
$this->mergeConfigFrom($configPath, 'blog-api'); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array<string>|null | ||
*/ | ||
public function provides(): ?array | ||
{ | ||
return ['blog-api']; | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function registerCommands(): void | ||
{ | ||
$this->commands([ | ||
// | ||
]); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
protected function registerAssetPublishing(): void | ||
{ | ||
$configPath = __DIR__.'/../../config/blog-api.php'; | ||
$this->publishes([ | ||
$configPath => config_path('blog-api.php'), | ||
], 'config'); | ||
|
||
$this->publishes([ | ||
__DIR__.'/../../lang' => resource_path('lang/packages/blog-api'), | ||
], 'lang'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Integration | ||
|-------------------------------------------------------------------------- | ||
*/ |