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