PackageInterface.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\Package;
  12. use Composer\Repository\RepositoryInterface;
  13. /**
  14. * Defines the essential information a package has that is used during solving/installation
  15. *
  16. * @author Jordi Boggiano <j.boggiano@seld.be>
  17. */
  18. interface PackageInterface
  19. {
  20. /**
  21. * Returns the package's name without version info, thus not a unique identifier
  22. *
  23. * @return string package name
  24. */
  25. public function getName();
  26. /**
  27. * Returns the package's pretty (i.e. with proper case) name
  28. *
  29. * @return string package name
  30. */
  31. public function getPrettyName();
  32. /**
  33. * Returns a set of names that could refer to this package
  34. *
  35. * No version or release type information should be included in any of the
  36. * names. Provided or replaced package names need to be returned as well.
  37. *
  38. * @return array An array of strings referring to this package
  39. */
  40. public function getNames();
  41. /**
  42. * Allows the solver to set an id for this package to refer to it.
  43. *
  44. * @param int $id
  45. */
  46. public function setId($id);
  47. /**
  48. * Retrieves the package's id set through setId
  49. *
  50. * @return int The previously set package id
  51. */
  52. public function getId();
  53. /**
  54. * Returns whether the package is a development virtual package or a concrete one
  55. *
  56. * @return bool
  57. */
  58. public function isDev();
  59. /**
  60. * Returns the package type, e.g. library
  61. *
  62. * @return string The package type
  63. */
  64. public function getType();
  65. /**
  66. * Returns the package targetDir property
  67. *
  68. * @return string The package targetDir
  69. */
  70. public function getTargetDir();
  71. /**
  72. * Returns the package extra data
  73. *
  74. * @return array The package extra data
  75. */
  76. public function getExtra();
  77. /**
  78. * Sets source from which this package was installed (source/dist).
  79. *
  80. * @param string $type source/dist
  81. */
  82. public function setInstallationSource($type);
  83. /**
  84. * Returns source from which this package was installed (source/dist).
  85. *
  86. * @return string source/dist
  87. */
  88. public function getInstallationSource();
  89. /**
  90. * Returns the repository type of this package, e.g. git, svn
  91. *
  92. * @return string The repository type
  93. */
  94. public function getSourceType();
  95. /**
  96. * Returns the repository url of this package, e.g. git://github.com/naderman/composer.git
  97. *
  98. * @return string The repository url
  99. */
  100. public function getSourceUrl();
  101. /**
  102. * Returns the repository reference of this package, e.g. master, 1.0.0 or a commit hash for git
  103. *
  104. * @return string The repository reference
  105. */
  106. public function getSourceReference();
  107. /**
  108. * Returns the type of the distribution archive of this version, e.g. zip, tarball
  109. *
  110. * @return string The repository type
  111. */
  112. public function getDistType();
  113. /**
  114. * Returns the url of the distribution archive of this version
  115. *
  116. * @return string
  117. */
  118. public function getDistUrl();
  119. /**
  120. * Returns the reference of the distribution archive of this version, e.g. master, 1.0.0 or a commit hash for git
  121. *
  122. * @return string
  123. */
  124. public function getDistReference();
  125. /**
  126. * Returns the sha1 checksum for the distribution archive of this version
  127. *
  128. * @return string
  129. */
  130. public function getDistSha1Checksum();
  131. /**
  132. * Returns the version of this package
  133. *
  134. * @return string version
  135. */
  136. public function getVersion();
  137. /**
  138. * Returns the pretty (i.e. non-normalized) version string of this package
  139. *
  140. * @return string version
  141. */
  142. public function getPrettyVersion();
  143. /**
  144. * Returns the release date of the package
  145. *
  146. * @return \DateTime
  147. */
  148. public function getReleaseDate();
  149. /**
  150. * Returns the stability of this package: one of (dev, alpha, beta, RC, stable)
  151. *
  152. * @return string
  153. */
  154. public function getStability();
  155. /**
  156. * Returns a set of links to packages which need to be installed before
  157. * this package can be installed
  158. *
  159. * @return array An array of package links defining required packages
  160. */
  161. public function getRequires();
  162. /**
  163. * Returns a set of links to packages which must not be installed at the
  164. * same time as this package
  165. *
  166. * @return array An array of package links defining conflicting packages
  167. */
  168. public function getConflicts();
  169. /**
  170. * Returns a set of links to virtual packages that are provided through
  171. * this package
  172. *
  173. * @return array An array of package links defining provided packages
  174. */
  175. public function getProvides();
  176. /**
  177. * Returns a set of links to packages which can alternatively be
  178. * satisfied by installing this package
  179. *
  180. * @return array An array of package links defining replaced packages
  181. */
  182. public function getReplaces();
  183. /**
  184. * Returns a set of links to packages which are required to develop
  185. * this package. These are installed if in dev mode.
  186. *
  187. * @return array An array of package links defining packages required for development
  188. */
  189. public function getDevRequires();
  190. /**
  191. * Returns a set of package names and reasons why they are useful in
  192. * combination with this package.
  193. *
  194. * @return array An array of package suggestions with descriptions
  195. */
  196. public function getSuggests();
  197. /**
  198. * Returns an associative array of autoloading rules
  199. *
  200. * {"<type>": {"<namespace": "<directory>"}}
  201. *
  202. * Type is either "psr-4", "psr-0", "classmap" or "files". Namespaces are mapped to
  203. * directories for autoloading using the type specified.
  204. *
  205. * @return array Mapping of autoloading rules
  206. */
  207. public function getAutoload();
  208. /**
  209. * Returns an associative array of dev autoloading rules
  210. *
  211. * {"<type>": {"<namespace": "<directory>"}}
  212. *
  213. * Type is either "psr-4", "psr-0", "classmap" or "files". Namespaces are mapped to
  214. * directories for autoloading using the type specified.
  215. *
  216. * @return array Mapping of dev autoloading rules
  217. */
  218. public function getDevAutoload();
  219. /**
  220. * Returns a list of directories which should get added to PHP's
  221. * include path.
  222. *
  223. * @return array
  224. */
  225. public function getIncludePaths();
  226. /**
  227. * Stores a reference to the repository that owns the package
  228. *
  229. * @param RepositoryInterface $repository
  230. */
  231. public function setRepository(RepositoryInterface $repository);
  232. /**
  233. * Returns a reference to the repository that owns the package
  234. *
  235. * @return RepositoryInterface
  236. */
  237. public function getRepository();
  238. /**
  239. * Returns the package binaries
  240. *
  241. * @return array
  242. */
  243. public function getBinaries();
  244. /**
  245. * Returns package unique name, constructed from name and version.
  246. *
  247. * @return string
  248. */
  249. public function getUniqueName();
  250. /**
  251. * Returns the package notification url
  252. *
  253. * @return string
  254. */
  255. public function getNotificationUrl();
  256. /**
  257. * Converts the package into a readable and unique string
  258. *
  259. * @return string
  260. */
  261. public function __toString();
  262. /**
  263. * Converts the package into a pretty readable string
  264. *
  265. * @return string
  266. */
  267. public function getPrettyString();
  268. /**
  269. * Returns a list of patterns to exclude from package archives
  270. *
  271. * @return array
  272. */
  273. public function getArchiveExcludes();
  274. /**
  275. * Configures the list of options to download package dist files
  276. *
  277. * @param array $options
  278. */
  279. public function setOptions(array $options);
  280. /**
  281. * Returns a list of options to download package dist files
  282. *
  283. * @return array
  284. */
  285. public function getOptions();
  286. }