Skip to content

Commit a2ea46a

Browse files
committed
Commit for first version
1 parent 71881bb commit a2ea46a

21 files changed

+296
-446
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Ask a question
4-
url: https://github.com/:vendor_name/:package_name/discussions/new?category=q-a
4+
url: https://github.com/jornatf/laravel-route-generator/discussions/new?category=q-a
55
about: Ask the community for help
66
- name: Request a feature
7-
url: https://github.com/:vendor_name/:package_name/discussions/new?category=ideas
7+
url: https://github.com/jornatf/laravel-route-generator/discussions/new?category=ideas
88
about: Share ideas for new features
99
- name: Report a security issue
10-
url: https://github.com/:vendor_name/:package_name/security/policy
10+
url: https://github.com/jornatf/laravel-route-generator/security/policy
1111
about: Learn how to notify us for sensitive bugs

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Changelog
22

3-
All notable changes to `:package_name` will be documented in this file.
3+
All notable changes to `laravel-route-generator` will be documented in this file.

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) :vendor_name <author@domain.com>
3+
Copyright (c) jornatf <me@jordnat.dev>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 82 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,109 @@
1-
# :package_description
1+
# Laravel Route Generator
22

3-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/:vendor_slug/:package_slug/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
6-
[![Total Downloads](https://img.shields.io/packagist/dt/:vendor_slug/:package_slug.svg?style=flat-square)](https://packagist.org/packages/:vendor_slug/:package_slug)
7-
<!--delete-->
8-
---
9-
This repo can be used to scaffold a Laravel package. Follow these steps to get started:
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/jornatf/laravel-route-generator.svg?style=flat-square)](https://packagist.org/packages/jornatf/laravel-route-generator)
4+
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/jornatf/laravel-route-generator/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/jornatf/laravel-route-generator/actions?query=workflow%3Arun-tests+branch%3Amain)
5+
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/jornatf/laravel-route-generator/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/jornatf/laravel-route-generator/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
6+
[![Total Downloads](https://img.shields.io/packagist/dt/jornatf/laravel-route-generator.svg?style=flat-square)](https://packagist.org/packages/jornatf/laravel-route-generator)
107

11-
1. Press the "Use this template" button at the top of this repo to create a new repo with the contents of this skeleton.
12-
2. Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files.
13-
3. Have fun creating your package.
14-
4. If you need help creating a package, consider picking up our <a href="https://laravelpackage.training">Laravel Package Training</a> video course.
15-
---
16-
<!--/delete-->
17-
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
8+
**A Laravel package to auto-generate routes from static blade view.**
189

19-
## Support us
10+
You can use this package to generated simple page that does not require processing in a controller.
2011

21-
[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/:package_name.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/:package_name)
22-
23-
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
24-
25-
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
12+
> #### If you like this package you can [Buy me a Coffee](https://www.buymeacoffee.com/jornatf) ☕️
2613
2714
## Installation
2815

2916
You can install the package via composer:
3017

3118
```bash
32-
composer require :vendor_slug/:package_slug
33-
```
34-
35-
You can publish and run the migrations with:
36-
37-
```bash
38-
php artisan vendor:publish --tag=":package_slug-migrations"
39-
php artisan migrate
19+
composer require jornatf/laravel-route-generator
4020
```
4121

4222
You can publish the config file with:
4323

4424
```bash
45-
php artisan vendor:publish --tag=":package_slug-config"
25+
php artisan vendor:publish --tag="laravel-route-generator-config"
4626
```
4727

4828
This is the contents of the published config file:
4929

5030
```php
5131
return [
32+
33+
/*
34+
|--------------------------------------------------------------------------
35+
| View base path
36+
|--------------------------------------------------------------------------
37+
|
38+
| Specify here the folder containing the blade views for the routes. This
39+
| base will not be in the URL.
40+
|
41+
*/
42+
43+
'view_base_path' => 'static',
44+
45+
/*
46+
|--------------------------------------------------------------------------
47+
| URL prefix
48+
|--------------------------------------------------------------------------
49+
|
50+
| Here you can specify a URL prefix. By default the value is null.
51+
|
52+
*/
53+
54+
'url_prefix' => null,
55+
56+
/*
57+
|--------------------------------------------------------------------------
58+
| Midlewares
59+
|--------------------------------------------------------------------------
60+
|
61+
| You can specify the middlewares that should be used for all automatically
62+
| generated URLs.
63+
|
64+
*/
65+
66+
'middlewares' => [],
5267
];
5368
```
5469

55-
Optionally, you can publish the views using
70+
## Usage
5671

57-
```bash
58-
php artisan vendor:publish --tag=":package_slug-views"
72+
To start and depending on the configurations, you must create in `resources\views`, the folder with the same name as the value of `view_base_path` (default: `static`).
73+
74+
Then you'll have:
75+
```
76+
resources/
77+
├─ views/
78+
│ ├─ static/
79+
│ │ ├─ about.blade.php
80+
│ │ ├─ contact.blade.php
5981
```
6082

61-
## Usage
83+
Here the routes will be generated:
84+
85+
| Method | URL | Route name |
86+
|---|---|---|
87+
| GET | /about | static.about |
88+
| GET | /contact | static.contact |
89+
90+
You can then check the generation of the routes with the Artisan command:
91+
```
92+
php artisan generated-route:list
93+
```
94+
95+
### Prefix
96+
97+
You can add prefix to your route group in the config file, like this:
98+
```php
99+
'url_prefix' => 'my_prefix',
100+
```
101+
102+
### Middlewares
62103

104+
You can add middlewares to your route group in the config file, like this:
63105
```php
64-
$variable = new VendorName\Skeleton();
65-
echo $variable->echoPhrase('Hello, VendorName!');
106+
'middlewares' => ['auth:sanctum'],
66107
```
67108

68109
## Testing
@@ -73,21 +114,21 @@ composer test
73114

74115
## Changelog
75116

76-
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
117+
> Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
77118
78119
## Contributing
79120

80-
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
121+
> Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
81122
82123
## Security Vulnerabilities
83124

84-
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
125+
> Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
85126
86127
## Credits
87128

88-
- [:author_name](https://github.com/:author_username)
129+
- [Jordan Nataf](https://github.com/jornatf)
89130
- [All Contributors](../../contributors)
90131

91132
## License
92133

93-
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
134+
> The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
{
2-
"name": ":vendor_slug/:package_slug",
3-
"description": ":package_description",
2+
"name": "jornatf/laravel-route-generator",
3+
"description": "Laravel package to auto-generate routes from static blade view.",
44
"keywords": [
5-
":vendor_name",
5+
"jornatf",
66
"laravel",
7-
":package_slug"
7+
"laravel-route-generator"
88
],
9-
"homepage": "https://github.com/:vendor_slug/:package_slug",
9+
"homepage": "https://github.com/jornatf/laravel-route-generator",
1010
"license": "MIT",
1111
"authors": [
1212
{
13-
"name": ":author_name",
14-
"email": "author@domain.com",
13+
"name": "Jordan Nataf",
14+
"email": "me@jordnat.dev",
1515
"role": "Developer"
1616
}
1717
],
1818
"require": {
19-
"php": "^8.1",
20-
"spatie/laravel-package-tools": "^1.14.0",
21-
"illuminate/contracts": "^10.0"
19+
"php": "^8.0.2",
20+
"spatie/laravel-package-tools": "^1.14.0"
2221
},
2322
"require-dev": {
2423
"laravel/pint": "^1.0",
@@ -35,19 +34,19 @@
3534
},
3635
"autoload": {
3736
"psr-4": {
38-
"VendorName\\Skeleton\\": "src/",
39-
"VendorName\\Skeleton\\Database\\Factories\\": "database/factories/"
37+
"Jornatf\\LaravelRouteGenerator\\": "src/",
38+
"Jornatf\\LaravelRouteGenerator\\Database\\Factories\\": "database/factories/"
4039
}
4140
},
4241
"autoload-dev": {
4342
"psr-4": {
44-
"VendorName\\Skeleton\\Tests\\": "tests/",
43+
"Jornatf\\LaravelRouteGenerator\\Tests\\": "tests/",
4544
"Workbench\\App\\": "workbench/app/"
4645
}
4746
},
4847
"scripts": {
4948
"post-autoload-dump": "@composer run prepare",
50-
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
49+
"clear": "@php vendor/bin/testbench package:purge-laravel-route-generator --ansi",
5150
"prepare": "@php vendor/bin/testbench package:discover --ansi",
5251
"build": [
5352
"@composer run prepare",
@@ -73,10 +72,10 @@
7372
"extra": {
7473
"laravel": {
7574
"providers": [
76-
"VendorName\\Skeleton\\SkeletonServiceProvider"
75+
"Jornatf\\LaravelRouteGenerator\\LaravelRouteGeneratorServiceProvider"
7776
],
7877
"aliases": {
79-
"Skeleton": "VendorName\\Skeleton\\Facades\\Skeleton"
78+
"LaravelRouteGenerator": "Jornatf\\LaravelRouteGenerator\\Facades\\LaravelRouteGenerator"
8079
}
8180
}
8281
},

config/route-generator.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| View base path
8+
|--------------------------------------------------------------------------
9+
|
10+
| Specify here the folder containing the blade views for the routes. This
11+
| base will not be in the URL.
12+
|
13+
*/
14+
15+
'view_base_path' => 'static',
16+
17+
/*
18+
|--------------------------------------------------------------------------
19+
| URL prefix
20+
|--------------------------------------------------------------------------
21+
|
22+
| Here you can specify a URL prefix. By default the value is null.
23+
|
24+
*/
25+
26+
'url_prefix' => null,
27+
28+
/*
29+
|--------------------------------------------------------------------------
30+
| Midlewares
31+
|--------------------------------------------------------------------------
32+
|
33+
| You can specify the middlewares that should be used for all automatically
34+
| generated URLs.
35+
|
36+
*/
37+
38+
'middlewares' => [],
39+
];

config/skeleton.php

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)