Comments (5)
Thanks for the suggestion! I'll see if it's possible without too much effort since I'm a little busy with work.
What kind of paths/use cases did you have in mind?
from laravel-file-generator.
Thanks for quick answer !
It's just the project root path '/'
So you can create any file in any folder into the project folder
from laravel-file-generator.
Hi, Any update ? :)
from laravel-file-generator.
Hey I spent some time trying to get this started, and turns out it's already possible, I had totally forgotten this feature existed:
https://github.com/skyronic/laravel-file-generator#getting-a-namespace-from-path
If you want to have a file that goes to "custom/MyClass.php", which lives in CustomNamespace
simply do this:
php artisan generate:new php__custom
This will create a file resources/boilerplates/php__custom.boilerplate.txt
I've set up the file like this:
{
"name": "My custom template",
"out": "custom/{{ $name }}.php",
"params": {
}
}
---
<?php
namespace {{ Format::getNamespace($path, "custom", "CustomNamespace") }};
class {{ Format::baseName($name) }} {
public function __construct () {
}
}
Running php artisan generate php:custom MyClass
gives you:
<?php
namespace CustomNamespace;
class MyClass {
public function __construct () {
}
}
You should be able to make it work with most scenarios by tweaking the formatNamespace
function call. Hopefully this solves your issue. Please feel free to re-open issue if you still have problems.
from laravel-file-generator.
Thank you so much :)))))
from laravel-file-generator.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-file-generator.