jeroen-g / laravel-packager Goto Github PK
View Code? Open in Web Editor NEWA cli tool for creating Laravel packages
License: Other
A cli tool for creating Laravel packages
License: Other
The vendor namespace and package name should be lowercased in the directory tree, but they should be StudlyCased in the class definition.
When I run:
$ artisan packager:new tokenly fluentd-logger
The Expected result is:
Should create a namespace of namespace definition of Tokenly\FluentdLogger;
The actual Result is:
Creates namespace tokenly\fluentd-logger;
Here is an example of capitilization in a Laravel vendor package:
I have error = There are no commands defined in the "packager" namespace.
I do all from the last issue for this theme ( composer dumpautoload and other)!
Namespace for views, config etc use Vendor Name and not Package Name.
For example:
// $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'myvendorname');
// $this->loadViewsFrom(__DIR__.'/../resources/views', 'myvendorname');
Problem 1
- Conclusion: don't install jeroen-g/laravel-packager v0.1
- Conclusion: remove guzzlehttp/guzzle 6.0.1
- Installation request for jeroen-g/laravel-packager ^0.1.0@dev -> satisfiable by jeroen-g/laravel-packager[0.1.x-dev, v0.1].
- Conclusion: don't install guzzlehttp/guzzle 6.0.1
- jeroen-g/laravel-packager 0.1.x-dev requires guzzlehttp/guzzle ~4.0 -> satisfiable by guzzlehttp/guzzle[4.0.0, 4.0.0-rc.1, 4.0.0-rc.2, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.1.2, 4.1.3,
4.1.4, 4.1.5, 4.1.6, 4.1.7, 4.1.8, 4.2.0, 4.2.1, 4.2.2, 4.2.3].
- Can only install one of: guzzlehttp/guzzle[4.0.0, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.0.0-rc.1, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.0.0-rc.2, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.0.1, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.0.2, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.0, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.1, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.2, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.3, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.4, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.5, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.6, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.7, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.1.8, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.2.0, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.2.1, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.2.2, 6.0.1].
- Can only install one of: guzzlehttp/guzzle[4.2.3, 6.0.1].
- Installation request for guzzlehttp/guzzle == 6.0.1.0 -> satisfiable by guzzlehttp/guzzle[6.0.1].
At the moment, using the php artisan packager:get
or php artisan packager:git
commands will still create entries within config/app.php
and composer.json
even if the download step is not successful.
This was noticed when trying to perform a php artisan packager:git
on a package. My github account has 2fa enabled, so authentification failed when trying to download the package. However updates were made to these files.
It would be important to ensure that the package has be installed before updating composer.json
or config/app.php
.
I get this error after running:
php artisan packager:publish HappyDemon EchoServer https://github.com/happyDemon/echo-server.git
After digging in the code I'm also unable to find the method.
I've added a pull request #52
Maybe an option could be added to the get function.
--host or --provider=Bitbucket
and the url has '/branch/master.zip' appended instead of '/archive/master.zip'
when i try to use the package using composer i get the error
[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected '->' (T_OBJECT_OPERATOR)
I run php artisan packager:new MyVendor MyPackage
Output:
0/6 [>---------------------------] 0% Creating package MyVendor\MyPackage...
1/6 [====>-----------------------] 16% Creating packages directory...
2/6 [=========>------------------] 33% Creating vendor...
3/6 [==============>-------------] 50% Downloading skeleton...
Symfony\Component\Debug\Exception\FatalThrowableError : Class 'ZipArchive' not found
at /var/www/app/vendor/jeroen-g/laravel-packager/src/FileHandler.php:128
124| * @return $this
125| */
126| public function extract($zipFile, $directory)
127| {
> 128| $archive = new ZipArchive;
129| $archive->open($zipFile);
130| $archive->extractTo($directory);
131| $archive->close();
132|
Exception trace:
1 JeroenG\Packager\Conveyor::extract("/var/www/app/package2d6f12b6c0fa64f77a58cef3cca4b741.zip", "/var/www/app/packages/MyVendor")
/var/www/app/vendor/jeroen-g/laravel-packager/src/Conveyor.php:67
2 JeroenG\Packager\Conveyor::downloadSkeleton()
/var/www/app/debt/vendor/jeroen-g/laravel-packager/src/Commands/NewPackage.php:91
Please use the argument -v to see more details.
composer info | grep laravel-packager
jeroen-g/laravel-packager V2.1.3 A cli tool for creating Laravel packages.
I have created routes/Api.php file in package. and create one route(Route::get('complaint', 'IndexController@index');) in Api.php file. but when i run this route it returns error "Sorry, the page you are looking for could not be found." Please let me know how can i run routes which are created in package,
GetComposer.org states the following about naming packages:
Note: If you don't know what to use as a vendor name, your GitHub username is usually a good bet. While package names are case insensitive, the convention is all lowercase and dashes for word separation.
Issuing the following, however, blindly creates PHP classes using hyphens instead of dropping the hyphens:
artisan packager:new My-Vendor My-Package
I'm fairly new to Composer, and wishing to follow best practices, so if hyphens are frowned upon, let me know. My planned package names are composed of these components: "Namespace-Type-ID", since I will have many packages.
Example: CMS-Template-001
I don't want to be seeing my classes called "CmsTemplate001", since that's just ugly, even if it's conventional. I would be happy with CMS_Template_001 as a class name, composed from "CMS-Template-001"... maybe this is an option?
Suggestions? Recommendations?
Hi,
Thanks for the hard work.
Will this package works with Gitlab too ? For private repo/package.
Thanks
Hi, I have installed the package via composer, it was working before but today after I run composer update, I couldn't see it in the php artisan commands list. What might've been happened? How can I fix it?
Not a big issue since everyone needs to change the file anyway, but the semicolon after the namespace is missing in SkeletonClass.php after generating a new package.
[ErrorException]
ZipArchive::extractTo(): Invalid or uninitialized Zip object
i'm fixed this issue
replace function download
public function olddownload($zipFile, $source)
{
$client = new Client(['verify' => env('CURL_VERIFY', true)]);
$response = $client->get($source);
file_put_contents($zipFile, $response->getBody());
return $this;
}
To
public function download($zipFile, $source)
{
file_put_contents($zipFile, fopen($source, 'r'), LOCK_EX);
return $this;
}
in PackagerHelper.php
I run
php artisan packager:publish Abkrim AbkCpanel
Why?
Command on exec is wron because forget a semicolon after cd command ";".
I like push a request on github, but i not a great user of github.
I clone your repo, make change, but github say me wrong user & password (usually use SSH Keys)
code ok for line 66 on PublishPackage
exec('cd '.$this->conveyor->packagePath().'; git init && git add --all && git commit -m "Initial commit"');
** bad code **
exec('cd '.$this->conveyor->packagePath().' git init && git add --all && git commit -m "Initial commit"');
Best regards
For someone that would like to help out: after the packager-skeleton is downloaded, and filenames are renamed for the vendor and name, the rewriteRules.php manifest should be deleted.
I have set the providers to JeroenG\Packager\PackagerServiceProvider::class instead of 'JeroenG\Packager\PackagerServiceProvider' as per the Laravel 5.2 specifications.
However when I run the command php artisan packager: new MyVendor MyPackage I get the error below.
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "packager" namespace.
Is there a way to work around this? Or Should should I wait for a newer version?
When generating the composer.json file, the string search/replace strips out "league/:packagename" which works fine for the "name" attribute but ends up with a malformed github link in the "homepage" attribute.
example of generated composer.json with error
"name": "Landjea/TestingPackage",
👍
...
"homepage": "https://github.com/thephpLandjea/TestingPackage"
💥
The command needs to strip out "thephpleague/:packagename", as well, to fix this. Probably first or else it won't exist when it gets there. I'll send a PR for it.
Hi, first time developing packages for Laravel. Great work by the way!
Quick question, why is it that php artisan vendor:publish
doesn't display my new package option?
Could you give a quick sample or idea on how to integrate this with Laravel package development??
Thanks!
Is there any way to simple publish package?
Or should I just in cmd / terminal go to package folder and use:
git init && git add --all && git commit -m "my sweet commit" && git add origin master [repo_url] && git push origin master
If it's only way then what about new command like
php artisan:packager publish
It could get repo url from composer.json
[GuzzleHttp\Exception\RequestException]
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.ht
ml)
solved..
1.https://curl.haxx.se/ca/cacert.pem download then paste it server php/extras/ssl
2. search curl in your php.ini then
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="C:\Program Files (x86)\Ampps\php\extras\ssl\cacert.pem"
Hi, I've generated new package using your plugin. Everything works ok except helpers.php file.. Composer doesn't dump this file into the autoload_files.php so I can't access functions that are defined it the file... Any idea?
Thanks...
When i run
./artisan
I get
The command defined in "JeroenG\Packager\PackagerGetCommand" cannot have an empty name.
I have the same issue, I run the composer command and added the service provider in the config/app.php but packager command is not registered!
After 75% ("cloning repository") Packager quits with the error
In GitPackage.php line 97:
Object of class JeroenG\Packager\Conveyor could not be converted to string
Aha god i'm stupid. Please delete this
Hi,
is it possible to have a package name like MyAwesomePackage that becomes my-awesome-package rather than myawesomepackage?
I get the following error message when I try to use your package.
[GuzzleHttp\Exception\RequestException]
cURL error 60: SSL certificate problem: unable to get local issuer certificate (see http://curl.haxx.se/libcurl/c/libcurl-errors.ht
ml)
I can not use cURL in my environment (behind a proxy) so I guess it's a non-starter. So just thought I should let you know that it is a requirement of being able to use your package.
Thanks.
Using the packager:git
command, url segments are used to create the service provider class entry in the config/app.php
file. This will most likely need to incorrect registering of plugin service providers. For example, running the command:
php artisan packager:git https://github.com/Jeroen-G/laravel-packager
Will result in the following being added to config/app.php
:
jeroen-g\laravel-packager\laravel-packagerServiceProvider::class
rather than:
JeroenG\Packager\PackagerServiceProvider::class
Although vendor
and package
can be passed as parameters, running this command without these arguments does not automatically put the default vendor
and package
into title case.
Secondly, in the event of the user installing a package with a hyphen, there is no prompt to run the command with the vendor
and package
arguments.
php artisan packager:new 4n70w4 Laravel-OKVED
0/6 [>---------------------------] 0% Creating package 4n70w4\Laravel-OKVED...
1/6 [====>-----------------------] 16% Creating packages directory...
2/6 [=========>------------------] 33% Creating vendor...
3/6 [==============>-------------] 50% Downloading skeleton...
4/6 [==================>---------] 66% Replacing skeleton placeholders...
5/6 [=======================>----] 83% Dumping autoloads and discovering package...
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
6/6 [============================] 100% Package created successfully!
Generated packages/4n70w4/Laravel-OKVED/src/Laravel-OKVED.php:
<?php
namespace 4n70w4\Laravel-OKVED;
class Laravel-OKVED
{
// Build wonderful things
}
The class name can be any valid label, provided it is not a PHP reserved word. A valid class name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: ^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$.
I've been using this package in my project and one of the machines it has to run on has PHP 5.6 installed.
The package runs fine on PHP7.
The problem is in PackagerHelper.php on line number 195.
The short return (app()['composer'])->dumpAutoloads();
you are using there is not allowed in PHP 5.6.
I think these changes came in with changeset d4332f4.
The error that I get is:
> php artisan clear-compiled
PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /vendor/jeroen-g/laravel-packager/src/PackagerHelper.php on line 195
[Symfony\Component\Debug\Exception\FatalErrorException]
syntax error, unexpected '->' (T_OBJECT_OPERATOR)
Script php artisan clear-compiled handling the post-install-cmd event returned with error code 255
When using the packager:get command I am unable to make changes and push them back to the repo without checking the package out in another area and then moving it into the packages directory.
hi , i need a package contain route , controllers , views .
do @Jeroen-G support this?
I've built a package within a test project by php artisan packager:new MyVendor MyPackage
. Now the MyPackage
has a dependency on spatie/laravel-permission
. How do I get the parent package to be aware of this dependency and publish the configuration file?
I am trying to create a package with vendor name and package name lowercase, and using "-".
If I run:
php artisan packager:new myvendor laravel-package
Then all classes are created like:
namespace myvendor\laravel-package;
and not camelcased
Should not be vendor and package all lowercase and and I should be able to use like "laravel-mypackage" as name.
Thanks
If you do run the package on Laravel 5.5+, package auto-discovery takes care of the magic of adding the service provider. Be aware that the auto-discovery also means that this package is loaded in your production environment. Therefore you may disable auto-discovery and instead put in your AppServiceProvider something like this:
But I don't get the difference of doing a conditional service provider load vs composer require --dev
, would that be equally working?. I'm sorry if I'm missing something. Thanks for this great tool.
Hi,
I have an error when i try to run: sudo php artisan packager:get https://github.com/joelmatiassilva/loaderio.git
I see in my console:
0/5 [>---------------------------] 0% Creating package joelmatiassilva\loaderio.git...
1/5 [=====>----------------------] 20% Creating packages directory...
2/5 [===========>----------------] 40% Creating vendor...
3/5 [================>-----------] 60% Downloading from Github...
[GuzzleHttp\Exception\ClientException]
Any idea what is happening?
Failed to create a service provider inside the package.
*laravel 5.0
After install..
php artisan
[LogicException]
The command defined in "JeroenG\Packager\PackagerNewCommand" cannot have an empty name.
At the moment, there is no way to update packages installed via git repository. This means that in the event of new changes being made to a repository, a git pull
will have to be ran within the package folder to update to the latest version. There may be scope here to do the following:
For example: php artisan packager:update {vendor?} {package?}
This could either expect the package
and vendor
arguments, or produce a table of installed packages to select a package.
The list command could be extended with an additional flag to find out if the packages are behind on their current branch. For example:
php artisan packager:list --status
I'm trying to create a package for the template. I have the problem that the views of the package, override the views correctly published with the command: php artisan vendor:publish
This is the code from my provider:
<?php
namespace Vendor\Package;
use Illuminate\Support\ServiceProvider;
class TemplatesServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/config/config.php' => config_path('vendor/package.php')
]);
$this->setupViews();
}
/**
* Register any package services.
*
* @return void
*/
public function register()
{
$this->mergeConfigFrom(__DIR__.'/config/config.php', 'vendor/package');
}
protected function setupViews()
{
$source = realpath(__DIR__.'/views');
$this->loadViewsFrom([$source, 'vendor/package'], 'vendor/package');
$this->publishes([
$source => base_path('resources/views/packages/Vendor/Package'),
]);
}
}
Thank you very much,
Daniele
I installed this package and stared developing a package. Later on I decided I didn't want it, so I removed the package using "composer remove". I then realized I had the package files still on the project, so I simply deleted them. I also checked that there were no references to the package in config/app.php and also in composer.json
now "php artisan" command doesn't work. It returns this error:
"In ProviderRepository.php line 208:
Class 'Vendor\Package\PackageServiceProvider' not found"
Nothing works. Searched EVERYWHERE in the project trying to find any string with any resemblance to the package name, nothing. Cleared caches from everything. Reinstalled Composer. And nothing....
It seem's there's a reference to this package somewhere outside the project, but I can't find where.
If I don't find a solution I might need to restart the whole project as composer and artisan doesn't work at all.
php artisan packager:remove v1 p1
is deleting everything inside v1
I have 2 laravel projects my-own-packages
and App1
my-own-packages
using php artisan packager:new v1 p1
App1
's composer.json
contains "repositories": [{ "type": "path", "url": "../my-own-package/packages/*/*"}]
, so my own packages can be pulled by running composer require v1/p1
and so on.App2
can re-use v1/p1
via composerphp artisan packager:remove v1 p1
, artisan deleted several other packages inside my-own-packages/packages/v1
before some permissions issue caused it to throw an exception.App1/vendor/v1/p1
instead of App1/packages/v1/p1
php artisan packager:disable v1 p1
in my-own-packages
and then manually delete my-own-packages/packages/v1/p1
Thank you.
I tried to clone with SSH,
php artisan packager:git [email protected]:repo/rep.git
but it says
[ErrorException]
Undefined offset: 3
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'MyVendor\MyPackage\MyPackageServiceProvider' not found
I have installed "Jeroen-G/laravel-packager" which is successfully working. I have created first packge using command "php artisan packager:new MyVendor MyPackage" but when i am trying to run Git/Get Command its throwing this error.
Hello,
i wanted to mention that your latest update (1.5.3) is not compatible with Laravel 5.1 since Illuminate\Support\Composer is not included.
Maybe you add another dependency to the composer.json, so future developer do not have to investigate the issue.
It appears that when installing a package the vendor name is getting studly_case applied to it. My git username is jdavidabkr, and my packages are namespaced as jdavidbakr/foo and jdavidbakr/bar. However, when I create a new package both the composer.json and the config/app file are setting the namespace to Jdavidbakr/foo and Jdavidbakr/bar which is causing the classes to not resolve.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.