---
title: "How to Build Your First PHP Package"
url: https://daily.dev/posts/how-to-build-your-first-php-package-oyispbolb
source_url: https://laravel-news.com/create-a-php-package-from-scratch
type: article
source: "Laravel News"
published: 2024-08-26T15:13:25.506Z
updated: 2024-11-08T12:59:57.356Z
tags: ["webdev", "github", "php"]
reading_time: 8
upvotes: 94
comments: 3
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Build Your First PHP Package

**[Laravel News](https://daily.dev/sources/ln)** · 8 min read · 94 upvotes · 3 comments

## Summary

Learn how to create your first PHP package from scratch using Composer. This guide walks through initializing a Git repository, configuring the composer.json file, setting up autoloading, and adding basic source code. It also covers how to implement and organize tests using Pest PHP and Mockery. Finally, it provides tips for publishing your package on Packagist and automating version updates.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://laravel-news.com/create-a-php-package-from-scratch>

## Community discussion

Top comments from developers on daily.dev.

**@shravanuchil** · 0 upvotes

> Nice Share 😊

**@michaelhomeister** · 0 upvotes

> Nice walkthrough! Thanks for sharing!

**@abdulmlaik97** · 0 upvotes

> well writen.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#github](https://daily.dev/tags/github), [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/how-to-build-your-first-php-package-oyispbolb)
