Skip to main content

Publishing Package to Github & Packagist

Premium
4 min read

To make our package available to others, we just need to initialize the Git repository inside our folder of /packages/laraveldaily/laravel-permission-editor and push the code to GitHub, then register that repository on Packagist.

So, step by step...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 46 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

RB
Rajesh Budhathoki ✓ Link copied!

Image is missing in the following line:

This is the result, in Terminal:

PK
Povilas Korop ✓ Link copied!

Thanks for the notice, fixed!

GK
Gavin Kimpson ✓ Link copied!

Struggled a bit following the tutorial in places, but with some determination and lots of faff I actually released my first ever Laravel package! It won't set the world alight, but it will let you generate website thumbnails using the url2png API :) Feel free to have & any offer any recommendations :) https://github.com/gkimpson/url2png-laravel https://packagist.org/packages/gkimpson/url2png-laravel

PK
Povilas Korop ✓ Link copied!

Looks like a great start! Happy to inspire your journey to create packages. Could you speciffy the places where you struggled, maybe I could change something in the course material to be clearer?

GK
Gavin Kimpson ✓ Link copied!

It was probably more to do with me doing new concepts than anything you did wrong - although one part of chapter 5 - the PermissionEditorServiceProvider.php boot() method changes somewhat (the ->as('permission-editor'); is removed for instance - after a while I realised this is needed. It was still a very good tutorial and the final chapter with the information regarding the releasing the packages was super useful as this was a first for me :)

I think a good way would be to do a very basic package initially & then have this permissions-editor package as a more advanced package (as its involves other dependencies, routes, views etc..), similar to how you have done the Laravel Testing in two courses (one for beginners and one advanced).

Either way, I did a thing and made a package for the first time so i'm happy with that :) Keep up the good work Povilas!

PK
Povilas Korop ✓ Link copied!

Thanks again for the feedback, will keep in mind!

AA
Ali Al Qahtani ✓ Link copied!

Thank you so much That's very helpful

A
Akhtar ✓ Link copied!

I was trying to find a package development tutorial that will explain about dependencies and how to inlude them into my own package. Finally I found it here.

Thanks a lot Povilas.

Looking forward for new article based tutorials Like these as these save a lot of time.

M
macabrero ✓ Link copied!

Of several that I have tried, this is the first course through which I have been able to completely create a package to be able to reuse my code.

Very good material, thanks for the effort.

AA
Ammar Al-Humaikani ✓ Link copied!

so should we install our package dependencies like spati-permissions, before install our package ?

can we just dirctly install our package with it dependencies ?

thank you mr Povilas

M
Modestas ✓ Link copied!

You can set dependancies in your packages composer.json file. This will install the dependancies with your package at the same time. No need to install it separate

AA
Ammar Al-Humaikani ✓ Link copied!

Hey Mr.Modestas, so what if i publish new package depends on another packages with spesfic versions maybe......

can i let the end user when install my package download all dependencies of my package with right versions dirctly without write them on composer.json by him and without install them by him ?

because maybe the end user install wrong version, or maybe even don't relize that my package depends on another packages

M
Modestas ✓ Link copied!

All the packages and versions you define in your composer.json as dependancies - will be installed. These will be exact versions you need and it will not allow users to have the same package with higher/lower versions (will trigger composer incompatibility error)

AA
Ammar Al-Humaikani ✓ Link copied!

Great!

Thank you so much Mr.Modestas

EY
Elías Yambay ✓ Link copied!

Hi Povilas, congratulations to you and your team for this great tutorial.

I was wondering if the github repository has to be public in order to publish it in packagist. What if I have a modular application that works with multiple packages thatn can be optionally installed and those packages work only for that particular app? For example the main application has its core module that could be cloned from github, but then you could install other modules by requiring packages.

Since this packages only work with the core module, can they be a sort of private packages?

M
Modestas ✓ Link copied!

In case you need private packages (which it sounds that you do) - you need to use private packagist:

https://packagist.com/

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.