Register a package for cascading configuration.

@param  string  $package
@param  string  $hint
@param  string  $namespace
@return void
761224
public function package($package, $hint, $namespace = null)
	{
		$namespace = $this->getPackageNamespace($package, $namespace);

		$this->packages[] = $namespace;

		// First we will simply register the namespace with the repository so that it
		// can be loaded. Once we have done that we'll register an after namespace
		// callback so that we can cascade an application package configuration.
		$this->addNamespace($namespace, $hint);

		$this->afterLoading($namespace, function($me, $group, $items) use ($package)
		{
			$env = $me->getEnvironment();

			$loader = $me->getLoader();

			return $loader->cascadePackage($env, $package, $group, $items);
		});
	}
1105929
protected function publishAssets(string $package): void
    {
        if (! is_null($path = $this->getPath())) {
            $this->assets->publish($package, $path);
        } else {
            $this->assets->publishPackage($package);
        }

        $this->output->writeln('<info>Assets published for package:</info> '.$package);
    }
1202591
public function installPackageDir($package, $namespace, $packageAssetsDir)
    {
        $this->log($package->getTarget(), self::LOG_INFO, self::CODE_INSTALLING_DIR, array('namespace' => $namespace));
        if (!isset($this->assetsDirectories[$namespace])) {
            $this->log($package->getTarget(), self::LOG_WARNING, self::CODE_NO_MATCHING_DIR, array('namespace' => $namespace));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 0;
            return;
        }
        $this->log($package->getTarget(), self::LOG_INFO, self::CODE_MATCHING_DIR, array('namespace' => $namespace));
        // We get the project vendor path
        $vendorPath = $this->getVendorPath();
        // We get the target dir of the iterated package
        $targetDir = $package->getTarget();
        // We get the full path of the current assets directory
        $packagePath = $vendorPath
            . $targetDir . "/" . $packageAssetsDir;
        // We check if this path is a directory
        if ($this->directoryHandler->isDirectory($packagePath)) {
            $this->log($package->getTarget(), self::LOG_INFO, self::CODE_DIRECTORY, array('directory' => $this->assetsDirectories[$namespace]));
            $src = $packagePath;
            $dst = $vendorPath . "../" . $this->assetsDirectories[$namespace] . $targetDir;
            // We delete the remaining directory if any
            // In order to update it
            $this->directoryHandler->deleteDirectory($dst);
            // We finally copy the package assets-dir
            // Into the project assets-dir
            $this->directoryHandler->copyDirectory($src, $dst);
            $this->log($package->getTarget(), self::LOG_INFO, self::CODE_DIR_INSTALLED, array('destination' => $dst));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 1;
        } else {
            $this->log($package->getTarget(), self::LOG_ERROR, self::CODE_NOT_DIRECTORY, array('directory' => $this->assetsDirectories[$namespace]));
            $this->packagesStatuses[$package->getTarget()]['dirs'][$namespace]['status'] = 0;
        }
    }
1352166
public function publishPackage($package)
    {
        $source = $this->getSource($package);

        return $this->publish($package, $source);
    }
321459
protected function registerPackagesFromConfiguration($packageStatesConfiguration)
    {
        foreach ($packageStatesConfiguration['packages'] as $composerName => $packageStateConfiguration) {
            $this->registerPackageFromStateConfiguration($composerName, $packageStateConfiguration);
        }
    }
80219
private function requireComposerPackage($package)
    {
        $composer = $this->findComposer();
        $process = new Process($composer.' require '.$package.''.$this->getDevOption(),
                       null, null, null, null);
        $this->output->writeln('<info>Running composer require '.$package.$this->getDevOption().'</info>');
        $process->run(function ($type, $line) {
            $this->output->write($line);
        });
    }
614446
public function setPackage(AbstractPackage $package = null)
    {
        if ($package === null) {
            $package = new NullPackage();
        }

        $this->package = $package;

        return $this;
    }
230528
public static function enablePackage(PackageInterface $package)
    {
        $packageRepository = Factory::makePackageRepository($package);
        $bundleFactory = Factory::makeBundleFactory();
        $kernelManipulator = Factory::makeKernelManipulator();

        $composerPackage = $packageRepository->findOneByName($package->getName());
        $bundle = $bundleFactory->make($composerPackage->namespace);

        $kernelManipulator->addBundle($bundle->fullyQualifiedClassname);
    }
751761
public function addPath(string $path, string $namespace = null) : void
    {
        if (! $namespace) {
            $this->template->addLocation($path);
            return;
        }

        $this->template->addNamespace($namespace, $path);
    }
565287
public function addConfigComponent($package, $namespace, $path)
    {
        if ($this->hasPackageRepository()) {
            $this->app->make('config')->package($package, $path, $namespace);
        }
    }
1021348
public function registerPackage(string $sPackageClass, Closure $xClosure)
    {
        $this->aPackages[] = $sPackageClass;
        jaxon()->di()->set($sPackageClass, $xClosure);
    }
540399
public function packageExists($namespace, $package)
    {
        $folder = $this->vendorFolder . $namespace;
        $folderExists = file_exists($folder);

        if (!$folderExists) {
            return false;
        }

        $packageFolder = $folder . '/' . $package;
        $packageFolderExists = file_exists($packageFolder);

        return $packageFolderExists;
    }
705588
public function bind(Package $package = null)
    {
        $package = $package ?: new Package();
        
        $navMap = $this->xml->navMap;
        
        $this->consumeNavMap($navMap, $package->navigation->chapters);
        
        return $package;
    }
1356025
public function prependNamespace($namespace, $hints)
    {
        $hints = (array) $hints;

        if (isset($this->hints[$namespace])) {
            $hints = array_merge($hints, $this->hints[$namespace]);
        }

        $this->hints[$namespace] = $hints;
    }
1268694
def declare_namespace(packageName):
    """"""

    _imp.acquire_lock()
    try:
        if packageName in _namespace_packages:
            return

        path = sys.path
        parent, _, _ = packageName.rpartition('.')

        if parent:
            declare_namespace(parent)
            if parent not in _namespace_packages:
                __import__(parent)
            try:
                path = sys.modules[parent].__path__
            except AttributeError:
                raise TypeError("Not a package:", parent)

        # Track what packages are namespaces, so when new path items are added,
        # they can be updated
        _namespace_packages.setdefault(parent or None, []).append(packageName)
        _namespace_packages.setdefault(packageName, [])

        for path_item in path:
            # Ensure all the parent's path items are reflected in the child,
            # if they apply
            _handle_ns(packageName, path_item)

    finally:
        _imp.release_lock()
243767
private function registerPackageConfig()
	{
		if (isLaravel5())
		{
	        $this->app->bindShared($this->packageName.'.config', function($app)
			{
				$configNameSpace = 'vendor.'.$this->packageVendor.'.'.$this->packageName.'.';
		        // Register the corresponding config for package
				return new $this->packageConfigClass($app['config'], $configNameSpace);
			});
			
		}

	}
631328
protected function define(PackageDefinition $package)
    {
        $package->name('analytics');

        $package->metadata([
            'icon' => 'globe'
        ]);

        $package->dashboard()
            ->widgets(['config.*']);

        $package->modules([
            'config' => AnalyticsConfigModule::class
        ]);
    }