---
schema_version: "1"
id: 101b9b5902ece292b65a04eea7995a615e2ccc51c3e659fa618ea01e3afde29d
title: Apex Class Considerations for Packages
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/apps/apps-packaging-apex.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/apps-packaging-apex.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e65af7133048bf7d602231b8d4d21be427f3d25ac53be7060f7f8eac6f0625f3
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Apex Class Considerations for Packages

Keep these considerations in mind when you develop Apex classes for packages.

## Test Coverage

Any Apex that is included as part of your definition bundle must have at least 75% cumulative test coverage. When you upload your package to AppExchange, all tests are run to ensure that they run without errors. The tests are also run when the package is installed.

## Grant User Access for Apex Classes

An authenticated or guest user can access an `@AuraEnabled` Apex method only when the user’s profile or an assigned permission set allows access to the Apex class.

- To enable access to a `public` Apex controller that’s part of a managed package, a subscriber org must use a permission set. You can’t enable access to a `public` Apex controller from a managed package using a user profile.
- To enable access to a `global` Apex controller that’s part of a managed package, a subscriber org can use a permission set or a user profile.

## Apex Class Usage in Subscriber Orgs

Only methods marked with the `global` access modifier are accessible by Aura components from outside the managed package’s namespace. Methods marked with the `public` access modifier are accessible only to Aura components included in the managed package’s namespace.

If you declare an Apex method as `global`, you must also declare the Apex class that contains it as `global`.

An Aura component outside the package can access a public Apex method installed from a non-namespaced unlocked package. The Aura component can be installed from another package or created in the org. For accessing Apex methods, a non-namespaced unlocked package is treated the same as an unmanaged package.

**See Also**

- [Granting User Access for Apex Classes](https://developer.salesforce.com/docs/platform/aura-platform/apex/apex-grant-permission.md)
- [Apex Server-Side Controller Overview](https://developer.salesforce.com/docs/platform/aura-platform/controllers-server/controllers-server-apex.md)
- [_Apex Developer Guide_: Access Modifiers](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_access_modifiers.htm)
