{"id":20721331,"url":"https://github.com/dr-lab1/php-package-creation-with-composer","last_synced_at":"2026-04-13T04:01:57.886Z","repository":{"id":242357167,"uuid":"773713939","full_name":"Dr-Lab1/php-package-creation-with-composer","owner":"Dr-Lab1","description":"Ce repository est un tutoriel dédié à la création des package PHP mixtes. C'est-à-dire qu'ils sont allouables au PHP Native ainsi qu'aux frameworks tels que Laravel, Symfony, CakePHP, etc.","archived":false,"fork":false,"pushed_at":"2024-08-02T09:41:07.000Z","size":255,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T22:43:24.692Z","etag":null,"topics":["cakephp","composer","laravel","laravel-framework","laravel-package","package","package-manager","packages","packagist","php","symfony"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dr-Lab1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-18T09:11:47.000Z","updated_at":"2024-08-02T09:41:10.000Z","dependencies_parsed_at":"2024-11-17T03:27:11.488Z","dependency_job_id":"431be2c9-3b6e-448e-9b47-65589bc11ecc","html_url":"https://github.com/Dr-Lab1/php-package-creation-with-composer","commit_stats":null,"previous_names":["dr-lab1/laravel-package-creation-with-composer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dr-Lab1%2Fphp-package-creation-with-composer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dr-Lab1%2Fphp-package-creation-with-composer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dr-Lab1%2Fphp-package-creation-with-composer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dr-Lab1%2Fphp-package-creation-with-composer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dr-Lab1","download_url":"https://codeload.github.com/Dr-Lab1/php-package-creation-with-composer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242995915,"owners_count":20218829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cakephp","composer","laravel","laravel-framework","laravel-package","package","package-manager","packages","packagist","php","symfony"],"created_at":"2024-11-17T03:27:03.185Z","updated_at":"2025-12-25T04:50:56.680Z","avatar_url":"https://github.com/Dr-Lab1.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Locale\n- \u003ca href=\"#Comment-créer-un-package-PHP-avec-composer-et-le-deployer\" \u003e Français \u003ca/\u003e\n- \u003ca href=\"#How-to-create-a-PHP-package-with-composer-and-deploy-it\" \u003e English \u003ca/\u003e\n\n# Comment créer un package PHP avec composer et le deployer \n \n# Plan \n- \u003ca href=\"#installer-composer\" \u003e Installer Composer \u003ca/\u003e\n- \u003ca href=\"#créer-le-package\" \u003e Créer le package \u003ca/\u003e\n- \u003ca href=\"#tester-le-package-en-local\" \u003e Tester le package en local \u003ca/\u003e\n- \u003ca href=\"#tester-le-package-en-production\" \u003e Tester le package en production \u003ca/\u003e \n \n  \n# Installer composer \n\n**Introduction**\n\nComposer est un outil de gestion des dépendances en PHP. Il vous permet de déclarer les bibliothèques dont votre projet dépend et il les gérera (installation/mise à jour) pour vous.\n\n**Gestion des dépendances**\n\nComposer n'est pas un gestionnaire de packages dans le même sens que Yum ou Apt. Oui, il s'occupe de \"packages\" ou de bibliothèques, mais il les gère par projet, en les installant dans un répertoire (par exemple vendor) à l'intérieur de votre projet. Par défaut, il n'installe rien globalement. Il s'agit donc d'un gestionnaire de dépendances. Il supporte cependant un projet \"global\" par commodité via la commande global.\n\nCette idée n'est pas nouvelle et Composer est fortement inspiré par \u003ca href=\"https://www.npmjs.com/\" target=\"_blank\"\u003enpm\u003ca/\u003e de node et \u003ca href=\"https://bundler.io/\" target=\"_blank\"\u003ebundler\u003ca/\u003e de ruby.\n\n\u003ca href=\"https://getcomposer.org/doc/00-intro.md\"\u003eLa documentation officielle de Composer\u003ca/\u003e\n \n\u003ca href=\"https://getcomposer.org/download/\"\u003eLe lien de téléchargement de Composer\u003ca/\u003e \n\n# Créer le package\n\n**Initialisation du package**\n\nAvant de commencer cette étape, il faut d'abord s'assurer que votre composer est installé et est à jour.\n\n\n    composer init\n\nCette commande lancera une série de questions (prompts) qui permettront une configuration rapide et facile de notre package.\nCertaines questions seront obligatoires (*) et d'autres seront optionnelles :\n\n1. Package name (*)\n   \n   Ce paramètre est pris sous format \\\u003cvendor\u003e/\\\u003cname\u003e\n\n   C'est un paramètre important parce qu'il servira de namespace aux futurs utilisateurs du package.\n   Tâchez donc de bien entrer ces paramètres. Généralement, \\\u003cvendor\u003e correspond au nom de l'entité qui a développé le package et \\\u003cname\u003e le service du package\n\n   ex: orange/orangemoney\n\n   Attention :\n\n   - No space\n   - Lowercase format\n\n2. Description\n\n   C'est simplement décrire le package en quelque ligne. Ce paramètre est optionnel et peut être modifié à n'importe quel moment.\n\n   ex: TaskManager est un gestionnaire de tâches...\n\n4. Author\n\n   C'est pour entrer le nom de l'auteur.\n   Assez souvent, votre nom et votre email sont proposés par *Composer* lui-même. Dans ce cas, faites *enter* pour accepter, sinon entrez les informations que vous voulez bien.\n\n   Mais tout comme la description, l'auteur peut être modifié et on peut en rajouter autant qu'on veut.\n\n   ex:\n   \n       [\n    \n         {\n       \n           \"name\": \"Dr-Lab1\",\n           \"email\": \"drlab1@gmail.com\",\n           \"homepage\": \"https://github.com/Dr-Lab1\",\n           \"role\": \"Head developer\"\n       \n         },\n       \n         {\n       \n           \"name\": \"Jonathan\",\n           \"email\": \"jonathan@gmail.com\",\n           \"homepage\": \"https://github.com/Dr-Lab1\",\n           \"role\": \"developer\"\n       \n         },\n       \n       ]\n\n5. Minimum Stability\n\n   Ce paramètre est l'indicateur de stabilité du package. Il est conseillé de le laisser vide car le package est dans sa création et on ne sait pas quantifier la sa stabilité\n\n6. Package Type\n\n   Le type de package à développer.\n   \n   ex:\n\n   - library\n   - project\n   - metapackage\n   - composer-plugin\n\n7.  License\n\n    C'est la license du package. Laissez un vide simplement si vous n'en avez pas.\n\nCes opérations vont résulter en un fichier ***composer.json*** qui renfermera les configurations remplies ci-heaut. Il y a plusieurs autres possibiltés telles que ajouter les *dependencies* avec require: {}\n\nex :\n\n\n       {\n           \"name\": \"labyrinthe/payment\",\n           \"autoload\": {\n               \"psr-4\": {\n                   \"Orange\\\\Orangemoney\\\\\": \"src/\"\n               }\n           },\n           \"authors\": [\n               {\n               \n                   \"name\": \"Dr-Lab1\",\n                   \"email\": \"dblab1@gmail.com\"\n                   \n               }\n           ],\n           \"require\": {}\n       }\n\n**Organisation du package**\n\nIl y aura à la racine, un dossier ***src***, un dossier ***vendor***, et un fichier ***composer.json***.\n\nToute la logique du package sera codée dans le ***src***.\n\n\n# Tester le package en local\n\n1. Installer une nouvelle app laravel pour tester votre package. \n\n2. Allez sur composer.json de la nouvelle application et entrez ce code avant les propriétés ***require*** :\n\n   \n       \"repositories\":\n       [\n            {\n       \n                \"type\": \"path\",\n                \"url\": \"C:/laragon/www/orange-money\"\n       \n            }\n        ],\n\n3. Faites cette commande composer\n\n\n        composer require orange/orangemoney\n\n# Tester le package en production\n\n1. Créer votre compte \u003ca href=\"https://packagist.org/\" target=\"_blank\"\u003epackagist\u003ca/\u003e\n\n   Packagist est le dépôt principal de Composer. Il regroupe les paquets PHP publics installables avec Composer.\n   Toutes les commandes **Composer** que nous faisons pour install ou update nos dépendances sont en fait dirigées vers packagist car c'est lui qui gère la plupart des dépendances PHP.\n\n   De préférence, créer votre compte en utilisant votre compte GitHub possedant le code source de votre package.\n\n2. Puis allez sur \u003ca href=\"https://packagist.org/packages/submit\"\u003esubmit\u003ca/\u003e\n\n   En allant sur submit, entrez le lien de votre repository GiHub abritant le code source de votre package.\n\n   Assurez-vous qu'il soit **public** pour permettre à Packagist de l'enregistrer et d'y préléver certains détails importants, faire des mises à jour à chaque nouveau commit,... Remplissez les informations du package puis cliquer sur **submit**, voilà votre package est rendu public et utilisable partout dans le monde.\n\nMaintenant essayons notre package dans notre application !\n\n1. Installer une nouvelle app laravel pour tester votre package. \n\n3. Faites cette commande composer\n\n\n        composer require orange/orangemoney\n\nVous pouvez maintenant faire tout ce que vous voulez.\n\n\nMerci Infiniment d'avoir suivi ce tutoriel !\n\n\n\nBien cordialement,\n\n### \u003ca href=\"https://github.com/Dr-Lab1/\"\u003eDr-Lab1\u003ca/\u003e\n\n\n\n\n# How to create a PHP package with composer and deploy it\n\n# Plan\n- \u003ca href=\"#install-composer\" \u003e Install Composer \u003ca/\u003e\n- \u003ca href=\"#create-package\" \u003e Create package \u003ca/\u003e\n- \u003ca href=\"#local-package-testing\" \u003e Local package testing \u003ca/\u003e\n- \u003ca href=\"#production-package-testing\" \u003e Production package testing \u003ca/\u003e\n\n   \n# Install composer\n \n**Introduction**\n\nComposer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.\n\n**Dependency management**\n\nComposer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with \"packages\" or libraries, but it manages them on a per-project basis, installing them in a directory (e.g. vendor) inside your project. By default, it does not install anything globally. Thus, it is a dependency manager. It does however support a \"global\" project for convenience via the global command.\n\nThis idea is not new and Composer is strongly inspired by node's \u003ca href=\"https://www.npmjs.com/\" target=\"_blank\"\u003enpm\u003ca/\u003e and ruby's \u003ca href=\"https://bundler.io/\" target=\"_blank\"\u003ebundler\u003ca/\u003e.\n\n### - \u003ca href=\"https://getcomposer.org/doc/00-intro.md\"\u003eOfficial Composer documentation\u003ca/\u003e\n \n### - \u003ca href=\"https://getcomposer.org/download/\"\u003eComposer download link\u003ca/\u003e \n\n# Create package\n\n**Package initialization**\n\nBefore starting this step, you need to make sure that your composer is installed and up to date.\n\n    composer init\n\nThis command will launch a series of questions (prompts) that will allow quick and easy configuration of our package.\nSome questions are mandatory (*), while others are optional :\n\n1. Package name (*)\n   \n   This parameter is taken in the format \\\u003cvendor\u003e/\\\u003cname\u003e.\n\n   This is an important parameter because it will serve as the namespace for future users of the package. Make sure you enter these parameters correctly.\n   Generally, \u003cvendor\u003e corresponds to the name of the entity that developed the package and \u003cname\u003e to the package service.\n\n         ex: orange/orangemoney\n\n   Warning :\n\n   - No space\n   - Lowercase format\n\n3. Description\n\n   This simply describes the package in a few lines. This parameter is optional and can be changed at any time.\n   \n   ex: TaskManager is a task manager...\n\n5. Author\n\n   This is where you enter the author's name.\n   Quite often, your name and e-mail address are suggested by *Composer* itself. In this case, press *enter* to accept, otherwise enter whatever information you like.\n\n   But just like the description, the author can be changed and as many more added as you like.\n   \n   ex:\n   \n       [\n    \n         {\n       \n           \"name\": \"Dr-Lab1\",\n           \"email\": \"drlab1@gmail.com\",\n           \"homepage\": \"https://github.com/Dr-Lab1\",\n           \"role\": \"Head developer\"\n       \n         },\n       \n         {\n       \n           \"name\": \"Jonathan\",\n           \"email\": \"jonathan@gmail.com\",\n           \"homepage\": \"https://github.com/Dr-Lab1\",\n           \"role\": \"developer\"\n       \n         },\n       \n       ]\n\n7. Minimum Stability\n\n   This parameter is the package stability indicator. It is advisable to leave it empty, as the package is still being created and its stability cannot be quantified.\n\n8. Package Type\n\n   Type of package to develop.\n   \n   ex:\n\n   - library\n   - project\n   - metapackage\n   - composer-plugin\n\n9.  License\n\n    This is the package license. Just leave it blank if you don't have one.\n\nThese operations will result in a ***composer.json*** file, which will contain the configurations filled in above. There are several other possibilities, such as adding *dependencies* with require: {}\n\nex :\n\n\n       {\n           \"name\": \"labyrinthe/payment\",\n           \"autoload\": {\n               \"psr-4\": {\n                   \"Orange\\\\Orangemoney\\\\\": \"src/\"\n               }\n           },\n           \"authors\": [\n               {\n               \n                   \"name\": \"Dr-Lab1\",\n                   \"email\": \"dblab1@gmail.com\"\n                   \n               }\n           ],\n           \"require\": {}\n       }\n\n**Organisation du package**\n\nAt the root, there will be a ***src*** folder, a ***vendor*** folder, and a ***composer.json*** file.\n\nAll package logic is coded in the ***src***.\n\n\n# Local package testing\n\n1. Install a new laravel app to test your package. \n\n2. Go to composer.json of the new application and enter this code before the ***require*** properties:\n\n   \n       \"repositories\":\n       [\n            {\n       \n                \"type\": \"path\",\n                \"url\": \"C:/laragon/www/orange-money\"\n       \n            }\n        ],\n\n3. Make this Composer command\n\n        composer require orange/orangemoney\n\n# Production package testing\n\n1. Create your \u003ca href=\"https://packagist.org/\" target=\"_blank\"\u003epackagist\u003ca/\u003e account\n\n   Packagist is Composer's main repository. It contains all the public PHP packages that can be installed with Composer.\n   All the **Composer** commands we issue to install or update our dependencies are in fact directed to packagist, as it manages most PHP dependencies.\n   De préférence, créer votre compte en utilisant votre compte GitHub possedant le code source de votre package.\n\n3. Go to \u003ca href=\"https://packagist.org/packages/submit\"\u003esubmit\u003ca/\u003e\n\n   On submit, enter the link to your GiHub repository containing the source code for your package.\n\n   Make sure it's **public** to enable Packagist to register it and take important details from it, update it with each new commit, etc. Fill in the package details, click on **submit** and your package will be made public and available for use worldwide. Maintenant essayons notre package dans notre application !\n\n* Install a new laravel app to test your package. \n\n* Make this Composer command\n\n\n        composer require orange/orangemoney\n\nNow you can do whatever you want.\n\n\n\n\n\nThank you so much for following this tutorial!\n\nBest regards,\n\n### \u003ca href=\"https://github.com/Dr-Lab1/\"\u003eDr-Lab1\u003ca/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdr-lab1%2Fphp-package-creation-with-composer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdr-lab1%2Fphp-package-creation-with-composer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdr-lab1%2Fphp-package-creation-with-composer/lists"}