When you specify a package repository, you are basically providing all of the details that would be in that package's composer.json if it had one. For autoloading to work, an autoload
property for the package must be specified. The composer manual has details on the autoload
property.
If your bitbucket repository conforms to PSR-0 or PSR-4, you simply need to specify the correct standard, and where the classes to be loaded are stored in the repository. For example, with PSR-4 and your classes stored in the src/
directory:
{
"require": {
"jasongrimes": "dev-master"
},
"repositories": [
{
"type": "package",
"package": {
"name": "jasongrimes",
"version": "dev-master",
"source": {
"url": "mybitbucketurl",
"type": "git",
"reference": "origin/master"
},
"autoload": {
"psr-4": { "": "src/" }
}
}
}
]
}
Otherwise, you can use classmap
to specify directories or files to be scanned for .php
or .inc
files with classes. For example, if the class you are attempting to load is located in the file SimpleUser/UserServiceProvider.php
in your repository:
{
"require": {
"jasongrimes": "dev-master"
},
"repositories": [
{
"type": "package",
"package": {
"name": "jasongrimes",
"version": "dev-master",
"source": {
"url": "mybitbucketurl",
"type": "git",
"reference": "origin/master"
},
"autoload": {
"classmap": [ "SimpleUser/UserServiceProvider.php" ]
}
}
}
]
}