help/developer/composer/index.html
Friendica Robot db3e579467 d58f62838e
2022-07-27 21:01:35 +00:00

3599 lines
No EOL
77 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Friendica is a decentralised communications platform that integrates social communication. Our platform links to independent social projects and corporate services.">
<meta name="author" content="The Friendica project">
<link rel="canonical" href="https://friendi.ca/developer/composer/">
<link rel="icon" href="../../assets/images/friendica-32.png">
<meta name="generator" content="mkdocs-1.3.0, mkdocs-material-8.3.8">
<title>Composer - Friendica documentation</title>
<link rel="stylesheet" href="../../assets/stylesheets/main.1d29e8d0.min.css">
<link rel="stylesheet" href="../../assets/stylesheets/palette.cbb835fc.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../assets/stylesheets/friendica.css">
<script>__md_scope=new URL("../..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="none" data-md-color-accent="none">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#using-composer" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href="https://friendi.ca" title="Friendica documentation" class="md-header__button md-logo" aria-label="Friendica documentation" data-md-component="logo">
<img src="../../assets/images/friendica.svg" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Friendica documentation
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Composer
</span>
</div>
</div>
</div>
<div class="md-header__option">
<div class="md-select">
<button class="md-header__button md-icon" aria-label="Select language">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m12.87 15.07-2.54-2.51.03-.03A17.52 17.52 0 0 0 14.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04M18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12m-2.62 7 1.62-4.33L19.12 17h-3.24Z"/></svg>
</button>
<div class="md-select__inner">
<ul class="md-select__list">
<li class="md-select__item">
<a href="./" hreflang="en" class="md-select__link">
English
</a>
</li>
<li class="md-select__item">
<a href="../../de/developer/composer/" hreflang="de" class="md-select__link">
Deutsch
</a>
</li>
</ul>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<a href="javascript:void(0)" class="md-search__icon md-icon" aria-label="Share" data-clipboard data-clipboard-text="" data-md-component="search-share" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7 0-.24-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.15c-.05.21-.08.43-.08.66 0 1.61 1.31 2.91 2.92 2.91 1.61 0 2.92-1.3 2.92-2.91A2.92 2.92 0 0 0 18 16.08Z"/></svg>
</a>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41Z"/></svg>
</button>
</nav>
<div class="md-search__suggest" data-md-component="search-suggest"></div>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/friendica/friendica" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
friendica/friendica
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<nav class="md-tabs" aria-label="Tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a href="../.." class="md-tabs__link">
Home
</a>
</li>
<li class="md-tabs__item">
<a href="../../user/account-basics/" class="md-tabs__link">
User
</a>
</li>
<li class="md-tabs__item">
<a href="../../admin/install/" class="md-tabs__link">
Admin
</a>
</li>
<li class="md-tabs__item">
<a href="../" class="md-tabs__link md-tabs__link--active">
Developer
</a>
</li>
<li class="md-tabs__item">
<a href="../../bugs-and-issues/" class="md-tabs__link">
Bugs and Issues
</a>
</li>
</ul>
</div>
</nav>
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary md-nav--lifted" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="https://friendi.ca" title="Friendica documentation" class="md-nav__button md-logo" aria-label="Friendica documentation" data-md-component="logo">
<img src="../../assets/images/friendica.svg" alt="logo">
</a>
Friendica documentation
</label>
<div class="md-nav__source">
<a href="https://github.com/friendica/friendica" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
friendica/friendica
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../.." class="md-nav__link">
Home
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2" type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2">
User
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="User" data-md-level="1">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
User
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_1" type="checkbox" id="__nav_2_1" >
<label class="md-nav__link" for="__nav_2_1">
First Steps
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="First Steps" data-md-level="2">
<label class="md-nav__title" for="__nav_2_1">
<span class="md-nav__icon md-icon"></span>
First Steps
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../user/account-basics/" class="md-nav__link">
Account Basics
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_1_2" type="checkbox" id="__nav_2_1_2" >
<label class="md-nav__link" for="__nav_2_1_2">
Quick Start
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Quick Start" data-md-level="3">
<label class="md-nav__title" for="__nav_2_1_2">
<span class="md-nav__icon md-icon"></span>
Quick Start
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../user/quick-start/guide/" class="md-nav__link">
Start
</a>
</li>
<li class="md-nav__item">
<a href="../../user/quick-start/network/" class="md-nav__link">
Network
</a>
</li>
<li class="md-nav__item">
<a href="../../user/quick-start/groups-and-pages/" class="md-nav__link">
Groups & Pages
</a>
</li>
<li class="md-nav__item">
<a href="../../user/quick-start/making-new-friends/" class="md-nav__link">
Making new friends
</a>
</li>
<li class="md-nav__item">
<a href="../../user/quick-start/finally/" class="md-nav__link">
Finally
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../user/text-editor/" class="md-nav__link">
Text editor
</a>
</li>
<li class="md-nav__item">
<a href="../../user/bbcode/" class="md-nav__link">
BBCode
</a>
</li>
<li class="md-nav__item">
<a href="../../user/text-comment/" class="md-nav__link">
Comments
</a>
</li>
<li class="md-nav__item">
<a href="../../user/accesskeys/" class="md-nav__link">
Accesskeys
</a>
</li>
<li class="md-nav__item">
<a href="../../user/events/" class="md-nav__link">
Events
</a>
</li>
<li class="md-nav__item">
<a href="../../user/keyboard-shortcuts/" class="md-nav__link">
Shortcuts
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_2" type="checkbox" id="__nav_2_2" >
<label class="md-nav__link" for="__nav_2_2">
You and other users
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="You and other users" data-md-level="2">
<label class="md-nav__title" for="__nav_2_2">
<span class="md-nav__icon md-icon"></span>
You and other users
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../user/connectors/" class="md-nav__link">
Connectors
</a>
</li>
<li class="md-nav__item">
<a href="../../user/making-friends/" class="md-nav__link">
Making friends
</a>
</li>
<li class="md-nav__item">
<a href="../../user/groups-and-privacy/" class="md-nav__link">
Groups & Privacy
</a>
</li>
<li class="md-nav__item">
<a href="../../user/tags-and-mentions/" class="md-nav__link">
Tags & Mentions
</a>
</li>
<li class="md-nav__item">
<a href="../../user/forums/" class="md-nav__link">
Forums
</a>
</li>
<li class="md-nav__item">
<a href="../../user/chats/" class="md-nav__link">
Chats
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_2_3" type="checkbox" id="__nav_2_3" >
<label class="md-nav__link" for="__nav_2_3">
Further information
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Further information" data-md-level="2">
<label class="md-nav__title" for="__nav_2_3">
<span class="md-nav__icon md-icon"></span>
Further information
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../user/move-account/" class="md-nav__link">
Move account
</a>
</li>
<li class="md-nav__item">
<a href="../../user/export-import-contacts/" class="md-nav__link">
Import / Export Contacts
</a>
</li>
<li class="md-nav__item">
<a href="../../user/remove-account/" class="md-nav__link">
Remove account
</a>
</li>
<li class="md-nav__item">
<a href="../../user/two-factor-authentication/" class="md-nav__link">
2FA
</a>
</li>
<li class="md-nav__item">
<a href="../../user/faq/" class="md-nav__link">
FAQ
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3" type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3">
Admin
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Admin" data-md-level="1">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Admin
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3_1" type="checkbox" id="__nav_3_1" >
<label class="md-nav__link" for="__nav_3_1">
Installation
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Installation" data-md-level="2">
<label class="md-nav__title" for="__nav_3_1">
<span class="md-nav__icon md-icon"></span>
Installation
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../admin/install/" class="md-nav__link">
Installation
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/update/" class="md-nav__link">
Update
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/migrate/" class="md-nav__link">
Migrate
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3_2" type="checkbox" id="__nav_3_2" >
<label class="md-nav__link" for="__nav_3_2">
Configuration
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Configuration" data-md-level="2">
<label class="md-nav__title" for="__nav_3_2">
<span class="md-nav__icon md-icon"></span>
Configuration
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../admin/settings/" class="md-nav__link">
Settings
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/config/" class="md-nav__link">
Config Values
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/ssl/" class="md-nav__link">
SSL
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/improve-performance/" class="md-nav__link">
Improve Performance
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/tools/" class="md-nav__link">
Tools
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_3_3" type="checkbox" id="__nav_3_3" >
<label class="md-nav__link" for="__nav_3_3">
Third Party
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Third Party" data-md-level="2">
<label class="md-nav__title" for="__nav_3_3">
<span class="md-nav__icon md-icon"></span>
Third Party
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../admin/installing-connectors/" class="md-nav__link">
Connectors
</a>
</li>
<li class="md-nav__item">
<a href="../../admin/install-ejabberd/" class="md-nav__link">
Install ejabberd
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../admin/faq/" class="md-nav__link">
FAQ
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4" type="checkbox" id="__nav_4" checked>
<label class="md-nav__link" for="__nav_4">
Developer
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Developer" data-md-level="1">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
Developer
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../" class="md-nav__link">
Get Started
</a>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_2" type="checkbox" id="__nav_4_2" >
<label class="md-nav__link" for="__nav_4_2">
Set Up
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Set Up" data-md-level="2">
<label class="md-nav__title" for="__nav_4_2">
<span class="md-nav__icon md-icon"></span>
Set Up
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../github/" class="md-nav__link">
GitHub
</a>
</li>
<li class="md-nav__item">
<a href="../vagrant/" class="md-nav__link">
Vagrant
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_3" type="checkbox" id="__nav_4_3" >
<label class="md-nav__link" for="__nav_4_3">
Code structure
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Code structure" data-md-level="2">
<label class="md-nav__title" for="__nav_4_3">
<span class="md-nav__icon md-icon"></span>
Code structure
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../domain-driven-design/" class="md-nav__link">
DDD
</a>
</li>
<li class="md-nav__item">
<a href="../addons/" class="md-nav__link">
Addons
</a>
</li>
<li class="md-nav__item">
<a href="../themes/" class="md-nav__link">
Themes
</a>
</li>
<li class="md-nav__item">
<a href="../smarty3-templates/" class="md-nav__link">
Smarty3
</a>
</li>
<li class="md-nav__item">
<a href="../addon-storage-backend/" class="md-nav__link">
Addon Storage Backend
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_4" type="checkbox" id="__nav_4_4" checked>
<label class="md-nav__link" for="__nav_4_4">
How To
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="How To" data-md-level="2">
<label class="md-nav__title" for="__nav_4_4">
<span class="md-nav__icon md-icon"></span>
How To
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../translations/" class="md-nav__link">
Translations
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Composer
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
Composer
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#how-to-use-composer" class="md-nav__link">
How to use Composer
</a>
<nav class="md-nav" aria-label="How to use Composer">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#installingupdating-friendica" class="md-nav__link">
Installing/Updating Friendica
</a>
<nav class="md-nav" aria-label="Installing/Updating Friendica">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#from-archive" class="md-nav__link">
From Archive
</a>
</li>
<li class="md-nav__item">
<a href="#installing-with-git" class="md-nav__link">
Installing with Git
</a>
</li>
<li class="md-nav__item">
<a href="#updating-with-git" class="md-nav__link">
Updating with Git
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#developing-friendica" class="md-nav__link">
Developing Friendica
</a>
<nav class="md-nav" aria-label="Developing Friendica">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#adding-a-third-party-library-to-friendica" class="md-nav__link">
Adding a third-party library to Friendica
</a>
</li>
<li class="md-nav__item">
<a href="#updating-an-existing-dependency" class="md-nav__link">
Updating an existing dependency
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#composer-faq" class="md-nav__link">
Composer FAQ
</a>
<nav class="md-nav" aria-label="Composer FAQ">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#i-used-the-composer-command-and-got-a-warning-about-not-to-run-it-as-root" class="md-nav__link">
I used the composer command and got a warning about not to run it as root.
</a>
</li>
<li class="md-nav__item">
<a href="#running-composer-with-sudo-complains-about-not-being-able-to-create-the-composer-cache-directory-in-rootcomposer" class="md-nav__link">
Running Composer with sudo complains about not being able to create the composer cache directory in /root/.composer
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#related" class="md-nav__link">
Related
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../how-to-move-classes-to-src/" class="md-nav__link">
src Migration
</a>
</li>
<li class="md-nav__item">
<a href="../tests/" class="md-nav__link">
Tests
</a>
</li>
<li class="md-nav__item">
<a href="../autoloader/" class="md-nav__link">
Autoloader
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_5" type="checkbox" id="__nav_4_5" >
<label class="md-nav__link" for="__nav_4_5">
Specification
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Specification" data-md-level="2">
<label class="md-nav__title" for="__nav_4_5">
<span class="md-nav__icon md-icon"></span>
Specification
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_5_1" type="checkbox" id="__nav_4_5_1" >
<label class="md-nav__link" for="__nav_4_5_1">
API
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="API" data-md-level="3">
<label class="md-nav__title" for="__nav_4_5_1">
<span class="md-nav__icon md-icon"></span>
API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../spec/api/" class="md-nav__link">
Usage
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/api/entities/" class="md-nav__link">
Entities
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/api/friendica/" class="md-nav__link">
Friendica
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/api/mastodon/" class="md-nav__link">
Mastodon
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/api/twitter/" class="md-nav__link">
Twitter
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/api/gnu-social/" class="md-nav__link">
GNU Social
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_5_2" type="checkbox" id="__nav_4_5_2" >
<label class="md-nav__link" for="__nav_4_5_2">
Database
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Database" data-md-level="3">
<label class="md-nav__title" for="__nav_4_5_2">
<span class="md-nav__icon md-icon"></span>
Database
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../spec/database/" class="md-nav__link">
Database Tables
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_2fa_app_specific_password/" class="md-nav__link">
2fa_app_specific_password
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_2fa_recovery_codes/" class="md-nav__link">
2fa_recovery_codes
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_2fa_trusted_browser/" class="md-nav__link">
2fa_trusted_browser
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_addon/" class="md-nav__link">
addon
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_apcontact/" class="md-nav__link">
apcontact
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_application/" class="md-nav__link">
application
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_application-marker/" class="md-nav__link">
application-marker
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_application-token/" class="md-nav__link">
application-token
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_attach/" class="md-nav__link">
attach
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_cache/" class="md-nav__link">
cache
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_config/" class="md-nav__link">
config
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_contact/" class="md-nav__link">
contact
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_contact-relation/" class="md-nav__link">
contact-relation
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_conv/" class="md-nav__link">
conv
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_conversation/" class="md-nav__link">
conversation
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_delayed-post/" class="md-nav__link">
delayed-post
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_diaspora-interaction/" class="md-nav__link">
diaspora-interaction
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_endpoint/" class="md-nav__link">
endpoint
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_event/" class="md-nav__link">
event
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_fcontact/" class="md-nav__link">
fcontact
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_fsuggest/" class="md-nav__link">
fsuggest
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_group/" class="md-nav__link">
group
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_group_member/" class="md-nav__link">
group_member
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_gserver/" class="md-nav__link">
gserver
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_gserver-tag/" class="md-nav__link">
gserver-tag
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_hook/" class="md-nav__link">
hook
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_inbox-entry/" class="md-nav__link">
inbox-entry
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_inbox-entry-receiver/" class="md-nav__link">
inbox-entry-receiver
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_inbox-status/" class="md-nav__link">
inbox-status
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_intro/" class="md-nav__link">
intro
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_item-uri/" class="md-nav__link">
item-uri
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_locks/" class="md-nav__link">
locks
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_mail/" class="md-nav__link">
mail
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_mailacct/" class="md-nav__link">
mailacct
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_manage/" class="md-nav__link">
manage
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_notification/" class="md-nav__link">
notification
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_notify/" class="md-nav__link">
notify
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_notify-threads/" class="md-nav__link">
notify-threads
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_oembed/" class="md-nav__link">
oembed
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_openwebauth-token/" class="md-nav__link">
openwebauth-token
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_parsed_url/" class="md-nav__link">
parsed_url
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_pconfig/" class="md-nav__link">
pconfig
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_permissionset/" class="md-nav__link">
permissionset
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_photo/" class="md-nav__link">
photo
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post/" class="md-nav__link">
post
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-category/" class="md-nav__link">
post-category
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-collection/" class="md-nav__link">
post-collection
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-content/" class="md-nav__link">
post-content
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-delivery/" class="md-nav__link">
post-delivery
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-delivery-data/" class="md-nav__link">
post-delivery-data
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-history/" class="md-nav__link">
post-history
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-link/" class="md-nav__link">
post-link
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-media/" class="md-nav__link">
post-media
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-question/" class="md-nav__link">
post-question
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-question-option/" class="md-nav__link">
post-question-option
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-tag/" class="md-nav__link">
post-tag
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-thread/" class="md-nav__link">
post-thread
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-thread-user/" class="md-nav__link">
post-thread-user
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-user/" class="md-nav__link">
post-user
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_post-user-notification/" class="md-nav__link">
post-user-notification
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_process/" class="md-nav__link">
process
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_profile/" class="md-nav__link">
profile
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_profile_field/" class="md-nav__link">
profile_field
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_push_subscriber/" class="md-nav__link">
push_subscriber
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_register/" class="md-nav__link">
register
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_search/" class="md-nav__link">
search
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_session/" class="md-nav__link">
session
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_storage/" class="md-nav__link">
storage
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_subscription/" class="md-nav__link">
subscription
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_tag/" class="md-nav__link">
tag
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_user/" class="md-nav__link">
user
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_user-contact/" class="md-nav__link">
user-contact
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_userd/" class="md-nav__link">
userd
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_verb/" class="md-nav__link">
verb
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_worker-ipc/" class="md-nav__link">
worker-ipc
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/database/db_workerqueue/" class="md-nav__link">
workerqueue
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_4_5_3" type="checkbox" id="__nav_4_5_3" >
<label class="md-nav__link" for="__nav_4_5_3">
Protocol
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Protocol" data-md-level="3">
<label class="md-nav__title" for="__nav_4_5_3">
<span class="md-nav__icon md-icon"></span>
Protocol
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../spec/protocol/protocol/" class="md-nav__link">
Protocols
</a>
</li>
<li class="md-nav__item">
<a href="../../spec/protocol/message-flow/" class="md-nav__link">
Message Flow
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../../bugs-and-issues/" class="md-nav__link">
Bugs and Issues
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table of contents">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table of contents
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#how-to-use-composer" class="md-nav__link">
How to use Composer
</a>
<nav class="md-nav" aria-label="How to use Composer">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#installingupdating-friendica" class="md-nav__link">
Installing/Updating Friendica
</a>
<nav class="md-nav" aria-label="Installing/Updating Friendica">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#from-archive" class="md-nav__link">
From Archive
</a>
</li>
<li class="md-nav__item">
<a href="#installing-with-git" class="md-nav__link">
Installing with Git
</a>
</li>
<li class="md-nav__item">
<a href="#updating-with-git" class="md-nav__link">
Updating with Git
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#developing-friendica" class="md-nav__link">
Developing Friendica
</a>
<nav class="md-nav" aria-label="Developing Friendica">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#adding-a-third-party-library-to-friendica" class="md-nav__link">
Adding a third-party library to Friendica
</a>
</li>
<li class="md-nav__item">
<a href="#updating-an-existing-dependency" class="md-nav__link">
Updating an existing dependency
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#composer-faq" class="md-nav__link">
Composer FAQ
</a>
<nav class="md-nav" aria-label="Composer FAQ">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#i-used-the-composer-command-and-got-a-warning-about-not-to-run-it-as-root" class="md-nav__link">
I used the composer command and got a warning about not to run it as root.
</a>
</li>
<li class="md-nav__item">
<a href="#running-composer-with-sudo-complains-about-not-being-able-to-create-the-composer-cache-directory-in-rootcomposer" class="md-nav__link">
Running Composer with sudo complains about not being able to create the composer cache directory in /root/.composer
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#related" class="md-nav__link">
Related
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<a href="https://github.com/friendica/friendica/edit/develop/doc/developer/composer.md" title="Edit this page" class="md-content__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20.71 7.04c.39-.39.39-1.04 0-1.41l-2.34-2.34c-.37-.39-1.02-.39-1.41 0l-1.84 1.83 3.75 3.75M3 17.25V21h3.75L17.81 9.93l-3.75-3.75L3 17.25Z"/></svg>
</a>
<nav class="md-tags" >
<span class="md-tag">developer</span>
<span class="md-tag">composer</span>
</nav>
<h1 id="using-composer">Using Composer<a class="headerlink" href="#using-composer" title="Permanent link">#</a></h1>
<p>Friendica uses <a href="https://getcomposer.org">Composer</a> to manage dependencies libraries and the class autoloader both for libraries and namespaced Friendica classes.</p>
<p>It's a command-line tool that downloads required libraries into the <code>vendor</code> folder and makes any namespaced class in <code>src</code> available through the whole application through <code>boot.php</code>.</p>
<ul>
<li><a href="../autoloader/">Class autoloading</a></li>
</ul>
<h2 id="how-to-use-composer">How to use Composer<a class="headerlink" href="#how-to-use-composer" title="Permanent link">#</a></h2>
<p>If you don't have Composer installed on your system, Friendica ships with a copy of it at <code>bin/composer.phar</code>.
For the purpose of this help, all examples will use this path to run Composer commands, however feel free to replace them with your own way of calling Composer.
Composer requires PHP CLI and the following examples assume it's available system-wide.</p>
<h3 id="installingupdating-friendica">Installing/Updating Friendica<a class="headerlink" href="#installingupdating-friendica" title="Permanent link">#</a></h3>
<h4 id="from-archive">From Archive<a class="headerlink" href="#from-archive" title="Permanent link">#</a></h4>
<p>If you just unpacked a Friendica release archive, you don't have to use Composer at all, all the required libraries are already bundled in the archive.</p>
<h4 id="installing-with-git">Installing with Git<a class="headerlink" href="#installing-with-git" title="Permanent link">#</a></h4>
<p>If you prefer to use <code>git</code>, you will have to run Composer to fetch the required libraries and build the autoloader before you can run Friendica.
Here are the typical commands you will have to run to do so:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a>~&gt; git clone https://github.com/friendica/friendica.git friendica
<a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>~/friendica&gt; <span class="nb">cd</span> friendica
<a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a>~/friendica&gt; bin/composer.phar install
</code></pre></div>
<p>That's it! Composer will take care of fetching all the required libraries in the <code>vendor</code> folder and build the autoloader to make those libraries available to Friendica.</p>
<h4 id="updating-with-git">Updating with Git<a class="headerlink" href="#updating-with-git" title="Permanent link">#</a></h4>
<p>Updating Friendica to the current stable or the latest develop version is easy with Git, just remember to run Composer after every branch pull.</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>~&gt; <span class="nb">cd</span> friendica
<a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a>~/friendica&gt; git pull
<a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a>~/friendica&gt; bin/composer.phar install
</code></pre></div>
<p>And that's it. If any library used by Friendica has been upgraded, Composer will fetch the version currently used by Friendica and refresh the autoloader to ensure the best performances.</p>
<h3 id="developing-friendica">Developing Friendica<a class="headerlink" href="#developing-friendica" title="Permanent link">#</a></h3>
<p>First, thanks for contributing to Friendica!
Composer is meant to be used by developers to maintain third-party libraries required by Friendica.
If you don't need to use any third-party library, then you don't need to use Composer beyond what is above to install/update Friendica.</p>
<h4 id="adding-a-third-party-library-to-friendica">Adding a third-party library to Friendica<a class="headerlink" href="#adding-a-third-party-library-to-friendica" title="Permanent link">#</a></h4>
<p>Does your shiny new <a href="../addons/">Addon</a> need to rely on a third-party library not required by Friendica yet?
First, this library should be available on <a href="https://packagist.org">Packagist</a> so that Composer knows how to fetch it directly just by mentioning its name in <code>composer.json</code>.</p>
<p>This file is the configuration of Friendica for Composer. It lists details about the Friendica project, but also a list of required dependencies and their target version.
Here's a simplified version of the one we currently use on Friendica:</p>
<div class="highlight"><pre><span></span><code><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="p">{</span><span class="w"></span>
<a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;friendica/friendica&quot;</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="w"> </span><span class="nt">&quot;description&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;A decentralized social network part of The Federation&quot;</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="w"> </span><span class="nt">&quot;type&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;project&quot;</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-2-5" name="__codelineno-2-5" href="#__codelineno-2-5"></a><span class="w"> </span><span class="p">[</span><span class="err">...</span><span class="p">]</span><span class="w"></span>
<a id="__codelineno-2-6" name="__codelineno-2-6" href="#__codelineno-2-6"></a><span class="w"> </span><span class="nt">&quot;require&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<a id="__codelineno-2-7" name="__codelineno-2-7" href="#__codelineno-2-7"></a><span class="w"> </span><span class="nt">&quot;ezyang/htmlpurifier&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;~4.7.0&quot;</span><span class="p">,</span><span class="w"></span>
<a id="__codelineno-2-8" name="__codelineno-2-8" href="#__codelineno-2-8"></a><span class="w"> </span><span class="nt">&quot;mobiledetect/mobiledetectlib&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;2.8.*&quot;</span><span class="w"></span>
<a id="__codelineno-2-9" name="__codelineno-2-9" href="#__codelineno-2-9"></a><span class="w"> </span><span class="p">},</span><span class="w"></span>
<a id="__codelineno-2-10" name="__codelineno-2-10" href="#__codelineno-2-10"></a><span class="w"> </span><span class="p">[</span><span class="err">...</span><span class="p">]</span><span class="w"></span>
<a id="__codelineno-2-11" name="__codelineno-2-11" href="#__codelineno-2-11"></a><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>The important part is under the <code>require</code> key, this is a list of all the libraries Friendica may need to run.
As you can see, at the moment we only require two, HTMLPurifier and MobileDetect.
Each library has a different target version, and <a href="https://getcomposer.org/doc/articles/versions.md#writing-basic-version-constraints">per Composer documentation about version constraints</a>, this means that:</p>
<ul>
<li>We will update HTMLPurifier up to version 4.8.0 excluded</li>
<li>We will update MobileDetect up to version 2.9.0 excluded</li>
</ul>
<p>There are other operators you can use to allow Composer to update the package up to the next major version excluded.
Or you can specify the exact version of the library if you code requires it, and Composer will never update it, although it isn't recommended.</p>
<p>To add a library, just add its Packagist identifier to the <code>require</code> list and set a target version string.</p>
<p>Then you should run <code>bin/composer.phar update</code> to add it to your local <code>vendor</code> folder and update the <code>composer.lock</code> file that specifies the current versions of the dependencies.</p>
<h4 id="updating-an-existing-dependency">Updating an existing dependency<a class="headerlink" href="#updating-an-existing-dependency" title="Permanent link">#</a></h4>
<p>If a package needs to be updated, whether to the next minor version or to the next major version provided you changed the adequate code in Friendica, simply edit <code>composer.json</code> to update the target version string of the relevant library.</p>
<p>Then you should run <code>bin/composer.phar update</code> to update it in your local <code>vendor</code> folder and update the <code>composer.lock</code> file that specifies the current versions of the dependencies.</p>
<p>Please note that you should commit both <code>composer.json</code> and <code>composer.lock</code> with your work every time you make a change to the former.</p>
<h2 id="composer-faq">Composer FAQ<a class="headerlink" href="#composer-faq" title="Permanent link">#</a></h2>
<h3 id="i-used-the-composer-command-and-got-a-warning-about-not-to-run-it-as-root">I used the <code>composer</code> command and got a warning about not to run it as root.<a class="headerlink" href="#i-used-the-composer-command-and-got-a-warning-about-not-to-run-it-as-root" title="Permanent link">#</a></h3>
<p>See <a href="">https://getcomposer.org/root</a>.
Composer should be run as the web server user, usually <code>www-data</code> with Apache or <code>http</code> with nginx.
If you can't switch to the web server user using <code>su - [web user]</code>, you can directly run the Composer command with <code>sudo -u [web user]</code>.</p>
<h3 id="running-composer-with-sudo-complains-about-not-being-able-to-create-the-composer-cache-directory-in-rootcomposer">Running Composer with <code>sudo</code> complains about not being able to create the composer cache directory in <code>/root/.composer</code><a class="headerlink" href="#running-composer-with-sudo-complains-about-not-being-able-to-create-the-composer-cache-directory-in-rootcomposer" title="Permanent link">#</a></h3>
<p>This is because <code>sudo</code> doesn't always change the <code>HOME</code> environment variable, which means that the command is run as the web server user but the system still uses <code>root</code> home directory.
However, you can temporarily change environment variable for the execution of a single command.
For Composer, this would be:
<div class="highlight"><pre><span></span><code><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>$&gt; <span class="nv">COMPOSER_HOME</span><span class="o">=</span>/var/tmp/composer sudo -u <span class="o">[</span>web user<span class="o">]</span> bin/composer.phar <span class="o">[</span>mode<span class="o">]</span>
</code></pre></div></p>
<h2 id="related">Related<a class="headerlink" href="#related" title="Permanent link">#</a></h2>
<ul>
<li><a href="../autoloader/">Class autoloading</a></li>
<li><a href="../how-to-move-classes-to-src/">How To Move Classes to <code>src</code></a></li>
</ul>
</article>
</div>
</div>
<a href="#" class="md-top md-icon" data-md-component="top" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12Z"/></svg>
Back to top
</a>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../translations/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Translations" rel="prev">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12Z"/></svg>
</div>
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Previous
</span>
Translations
</div>
</div>
</a>
<a href="../how-to-move-classes-to-src/" class="md-footer__link md-footer__link--next" aria-label="Next: src Migration" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
src Migration
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4Z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
<div class="md-copyright__highlight">
Copyright &copy; 2010-2022, the Friendica project
</div>
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../..", "features": ["content.code.annotate", "content.tooltips", "navigation.indexes", "navigation.sections", "navigation.tabs", "navigation.top", "navigation.tracking", "search.highlight", "search.share", "search.suggest", "toc.follow"], "search": "../../assets/javascripts/workers/search.b97dbffb.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version.title": "Select version"}}</script>
<script src="../../assets/javascripts/bundle.0238f547.min.js"></script>
</body>
</html>