Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Developer Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
brienne
Developer Documentation
Commits
bacaf7a0
Commit
bacaf7a0
authored
7 years ago
by
totten
Browse files
Options
Downloads
Patches
Plain Diff
Basics: File System -- Add section on composer, bower, packages
parent
45270eaf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/basics/filesystem.md
+49
-0
49 additions, 0 deletions
docs/basics/filesystem.md
with
49 additions
and
0 deletions
docs/basics/filesystem.md
+
49
−
0
View file @
bacaf7a0
...
...
@@ -79,6 +79,55 @@ echo Civi::paths()->getUrl("[civicrm.root]/.");
echo
Civi
::
paths
()
->
getUrl
(
"[civicrm.root]/README.md"
);
```
## Codebase: Dependencies
The CiviCRM codebase includes some third-party libraries. These are pulled
into three folders:
*
__
`vendor`
__
is collection of PHP libraries which are automatically downloaded
by
[
`composer`
](
http://getcomposer.org/
)
based on the
`composer.json`
configuration.
*
__
`bower_components`
__
is a collection of JS/CSS libraries which are automatically
downloaded by
[
`bower`
](
https://bower.io/
)
based on the
`bower.json`
configuration.
*
__
`packages`
__
is a manually curated collection of library files.
It's maintained in
[
`civicrm-packages.git`
](
https://github.com/civicrm/civicrm-packages/
)
.
!!! note "When adding a new dependency to core, use
`composer.json`
or
`bower.json`
."
### Tip: Programmatic lookup
Traditionally, one would use the root folder of
`civicrm-core`
to determine the path
or URL of a library, as in:
```
php
global
$civicrm_root
;
echo
"
$civircm_root
/packages/IDS/default_filter.xml"
;
```
This arrangement works, but it assumes that all three folders are immediate
descendents of the
`civicrm-core`
folder -- which may not hold in the
future.
In CiviCRM v4.7.21+, one should use
`Civi::paths()`
to lookup the path or
URL for a library:
```
php
echo
Civi
::
paths
()
->
getPath
(
'[civicrm.vendor]/dompdf/dompdf/README.md'
);
echo
Civi
::
paths
()
->
getUrl
(
'[civicrm.vendor]/dompdf/dompdf/README.md'
);
echo
Civi
::
paths
()
->
getPath
(
'[civicrm.bower]/jquery/dist/jquery.min.js'
);
echo
Civi
::
paths
()
->
getUrl
(
'[civicrm.bower]/jquery/dist/jquery.min.js'
);
echo
Civi
::
paths
()
->
getPath
(
'[civicrm.packages]/IDS/default_filter.xml'
);
echo
Civi
::
paths
()
->
getUrl
(
'[civicrm.packages]/IDS/default_filter.xml'
);
```
Additionally, to register JS/CSS resources in
`Civi::resources()`
, you can use
a shorthand with the path variables, as in:
```
php
echo
Civi
::
resources
()
->
addScriptFile
(
'civicrm.bower'
,
'jquery/dist/jquery.min.js'
);
```
## Local data files
CiviCRM also needs a files directory for storing a variety of site-specific
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment