Composer는 PHP에서 종속 관계를 관리하는 데 사용되는 도구입니다. 프로젝트에서 의존하는 외부 라이브러리(라이브러리)를 선언할 수 있으며 Composer가 이러한 종속 라이브러리 파일을 자동으로 설치합니다.
PHP Composer 설치
시스템 요구 사항:
Composer를 실행하려면 PHP5.3.2+ 이상의 환경이 필요합니다. 몇 가지 민감한 PHP 설정과 컴파일 플래그도 필요하지만, 비호환성이 있으면 설치 프로그램에서 경고를 표시합니다.
예를 들어, PHP 확장에 대한 요구 사항은 –disable-phar 없이 PHP를 설치하거나 다시 컴파일하는 것입니다
간단한 압축 파일 패키지가 아닌 소스 주소에서 패키지를 설치하려면 버전 제어를 설치해야 합니다. git, svn, hg 등과 같은 패키지용 도구입니다.
Composer는 다중 플랫폼과 호환되며 Windows, Linux 및 OSX에서 실행됩니다.
설치 실패에 대한 오류 메시지:
curl -sS https://getcomposer.org/installer | PHP #!/usr/bin/env php some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The phar extension is missing. Install it or recompile php without –disable-phar Your PHP (5.2.9) is too old, you must upgrade to PHP 5.3.2 or higher.
내 로컬 기본 개발 환경은 PHP 5.2.9입니다. PHP 5.2.9에 설치하려고 하면 버전이 너무 낮아서 업그레이드해야 한다는 메시지가 나타납니다. PHP 5.3 이상.
그래서 XAMPP 1.7.7 USB Lite 버전을 다운로드했습니다.
E:\USB\Dropbox\phpstorm\php53>E:\USB\xampp_177\php\php.exe -v PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
XAMPP 1.7.7의 PHP 환경은 5.3.8입니다. 내 PHP 환경이 PHP5.3.2 이상인지 확인한 후.
PHP 5.3 Composer 설치
E:\USB\Dropbox\phpstorm\php53>curl -sS https://getcomposer.org/installer | E:\USB\xampp_177\php\php.exe #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: The openssl extension is missing, which will reduce the security and stability o f Composer. If possible you should enable it or recompile php with –with-openssl Downloading… Composer successfully installed to: E:\USB\Dropbox\phpstorm\php53\composer.phar Use it: php composer.phar
참고:
XAMPP 1.7.7 Apache의 SSL 모듈을 꺼서 Composer에서 경고 메시지를 표시하고 보안을 위해 SSL 모듈을 활성화하도록 권장했습니다. 이유. 켜지지 않아도 사용에는 영향을 미치지 않습니다.
설치 중 매개변수는 실제 PHP 환경 경로로 변경되어야 합니다. 예: E:USBxampp_177phpphp.exe
Composer를 PHP 경로 + 명령으로 사용합니다. 우리가 설치한 환경에서는 E:USBxampp_177php/ php.exe 작곡가.phar 명령.
내가 설치한 환경은 Windows에 있고 PHP 5.3 환경이 기본 PHP 명령에 속하지 않는 경우에는 /usr/php/53/usr/bin/php를 사용해야 합니다. 예:
curl -sS https://getcomposer.org/installer | /usr/php/53/usr/bin/php
설치가 완료되면 설치된 버전을 확인해주세요.
E:\USB\Dropbox\phpstorm\php53>E:\USB\xampp_177\php/php.exe composer.phar -V Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33
PHP Composer 명령을 확인하세요:
E:\USB\Dropbox\phpstorm\php53>E:\USB\xampp_177\php/php.exe composer.phar ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33 Usage: [options] command [arguments] Options: –help -h Display this help message. –quiet -q Do not output any message. –verbose -v Increase verbosity of messages. –version -V Display this application version. –ansi Force ANSI output. –no-ansi Disable ANSI output. –no-interaction -n Do not ask any interactive question. –profile Display timing and memory usage information –working-dir -d If specified, use the given directory as working directory . Available commands: about Short information about Composer archive Create an archive of this composer package config Set config options create-project Create new project from a package into given directory. depends Shows which packages depend on the given package diagnose Diagnoses the system to identify common errors. dump-autoload Dumps the autoloader dumpautoload Dumps the autoloader help Displays help for a command init Creates a basic composer.json file in current directory. install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. list Lists commands require Adds required packages to your composer.json and installs the m run-script Run the scripts defined in composer.json. search Search for packages self-update Updates composer.phar to the latest version. selfupdate Updates composer.phar to the latest version. show Show information about packages status Show a list of locally modified packages update Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file. validate Validates a composer.json
이런 식으로 PHP5.3 환경의 Composer가 설치되었습니다.
마찬가지로 PHP 5.4 환경도 설치할 수 있습니다.
PHP 5.4 Composer 설치
XAMPP 1.8.1 USB 라이트 버전을 다운로드하면 PHP5.4.7 환경이 제공됩니다.
E:\USB\Dropbox\phpstorm\php53>E:\USB\xampp_181\php\php.exe -v PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
버전이 PHP 5.3.2 이상인지 확인한 후 설치를 시작하세요.
E:\USB\Dropbox\phpstorm\php54>curl -sS https://getcomposer.org/installer | E:\USB\xampp_181\php\php.exe #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: The openssl extension is missing, which will reduce the security and stability o f Composer. If possible you should enable it or recompile php with –with-openssl Downloading… Composer successfully installed to: E:\USB\Dropbox\phpstorm\php54\composer.phar Use it: php composer.phar
설치가 완료된 후 설치된 버전을 확인하세요.
E:\USB\Dropbox\phpstorm\php54>E:\USB\xampp_181\php/php.exe composer.phar -V Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33
이렇게 해서 PHP 5.4 환경의 Composer도 성공적으로 설치되었습니다.
PHP Composer 사용
여기에서는 PHP Composer를 사용하여 Symfony 프레임워크를 설치하는 방법을 간략하게 설명합니다.
먼저 명령의 표준 형식을 간략하게 설명하겠습니다.
php composer.phar create-project symfony/framework-standard-edition path/ 2.2.1
첫 번째 매개변수 PHP는 PHP 실행 명령을 가리키는 로컬 PHP 개발 환경입니다.
두 번째 매개변수는 작곡가.phar 모드에서 다운로드됩니다.
세 번째 매개변수는 create-project와 같은 작업 명령으로, 소프트웨어 패키지에서 지정된 디렉터리에 새 프로젝트를 생성하기 위한 것입니다.
네 번째 매개변수는 로컬 설치 디렉터리입니다.
다섯 번째 매개변수는 설치된 소프트웨어 패키지의 버전입니다.
우리가 PHP5.4 환경에 설치한 위에서 언급한 Composer에 따르면 설치 명령은 다음과 같습니다.
E:\USB\Dropbox\phpstorm\php54>E:\USB\xampp_181\php/php.exe composer.phar create-project symfony/framework-standard-edition E:\USB\xampp_181\htdocs\Symfony 2.2.1
설치 결과:
Installing symfony/framework-standard-edition (v2.2.1) – Installing symfony/framework-standard-edition (v2.2.1) Downloading: 100% Created project in E:\USB\xampp_181\htdocs\Symfony Loading composer repositories with package information Installing dependencies from lock file – Installing doctrine/lexer (v1.0) Downloading: 100% – Installing doctrine/annotations (v1.1) Downloading: 100% – Installing doctrine/cache (v1.0) Downloading: 100% – Installing doctrine/collections (v1.1) Downloading: 100% – Installing twig/twig (v1.12.2) Downloading: 100% – Installing psr/log (1.0.0) Downloading: 100% – Installing doctrine/inflector (v1.0) Downloading: 100% – Installing doctrine/common (2.4.0-RC1) Downloading: 100% – Installing symfony/symfony (v2.2.1) Downloading: 100% – Installing jdorn/sql-formatter (v1.2.0) Downloading: 100% – Installing doctrine/dbal (2.3.3) Downloading: 100% – Installing doctrine/doctrine-bundle (v1.2.0-beta1) Downloading: 100% – Installing doctrine/orm (2.3.3) Downloading: 100% – Installing jms/cg (1.0.0) Downloading: 100% – Installing phpoption/phpoption (1.2.0) Downloading: 100% – Installing jms/parser-lib (1.0.0) Downloading: 100% – Installing jms/metadata (1.3.0) Downloading: 100% – Installing jms/aop-bundle (1.0.0) Downloading: 100% – Installing jms/di-extra-bundle (1.3.0) Downloading: 100% – Installing jms/security-extra-bundle (1.4.0) Downloading: 100% – Installing sensio/distribution-bundle (v2.2.1) Downloading: 100% – Installing sensio/framework-extra-bundle (v2.2.1) Downloading: 100% – Installing sensio/generator-bundle (v2.2.1) Downloading: 100% – Installing kriswallsmith/assetic (v1.1.0-alpha4) Downloading: 100% – Installing symfony/assetic-bundle (v2.1.2) Downloading: 100% – Installing monolog/monolog (1.4.1) Downloading: 100% – Installing symfony/monolog-bundle (v2.2.0) Downloading: 100% – Installing swiftmailer/swiftmailer (v4.3.0) Downloading: 100% – Installing symfony/swiftmailer-bundle (v2.2.0) Downloading: 100% – Installing twig/extensions (v1.0.0) Downloading: 100% kriswallsmith/assetic suggests installing leafo/lessphp (Assetic provides the integration with the lessphp LESS compiler) kriswallsmith/assetic suggests installing leafo/scssphp (Assetic provides the integration with the scssphp SCSS compiler) kriswallsmith/assetic suggests installing leafo/scssphp-compass (Assetic provides the integration with the SCSS compass plugin) kriswallsmith/assetic suggests installing ptachoire/cssembed (Assetic provides the integration with phpcssembed to embed data uris) monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server) monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) monolog/monolog suggests installing mlehner/gelf-php (Allow sending log messages to a GrayLog2 server) monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server) Generating autoload files Clearing the cache for the dev environment with debug true Installing assets using the hard copy option Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework Installing assets for Acme\DemoBundle into web/bundles/acmedemo Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
명령줄 결과에서 전체 내용을 볼 수 있습니다. Symfony 프레임워크 설치 과정 및 결과.
PHP Composer는 종속성을 정의합니다
Composer는 사용 시 자동으로 작곡가.json 파일을 찾습니다. 작곡가.json은 전체 프로젝트의 종속성 패키지를 정의하는 데 사용됩니다. 예:
{ "require": { "monolog/monolog": "1.2.*" } }
종속 패키지에 대한 간단한 설명입니다. 우리 프로젝트에는 1.2부터 시작하는 모든 버전의 일부 모노로그/모놀로그 패키지가 필요합니다.
Composer는 PHP의 종속성 관리 도구입니다. Composer를 사용하면 소프트웨어를 게시할 때 많은 파일을 저장할 수 있고 종속 패키지의 버전을 제어할 수 있습니다.
위 내용은 이 글의 전체 내용입니다. 모든 분들의 학습에 도움이 되었으면 좋겠습니다. 더 많은 관련 내용은 PHP 중국어 홈페이지를 주목해주세요!
관련 권장 사항:
PHP 프레임워크 Laravel 플러그인 페이지 매김을 사용하여 사용자 정의 페이징을 구현하는 방법 정보
위 내용은 PHP 관리 종속성 도구인 Composer 설치 및 사용 정보의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

phpidifiesauser의 sssessionusessessioncookiesandssessionids.1) whensession_start () iscalled, phpgeneratesauniquessessionStoredInacookienamedPhpsSessIdonSeuser 'sbrowser.2) thisidallowsphptoretrievessessionDataTromServer.

PHP 세션의 보안은 다음 측정을 통해 달성 할 수 있습니다. 1. Session_REGENEREAT_ID ()를 사용하여 사용자가 로그인하거나 중요한 작업 일 때 세션 ID를 재생합니다. 2. HTTPS 프로토콜을 통해 전송 세션 ID를 암호화합니다. 3. 세션 _save_path ()를 사용하여 세션 데이터를 저장하고 권한을 올바르게 설정할 보안 디렉토리를 지정하십시오.

phpsessionfilesarestoredInTheRectorySpecifiedBysession.save_path, 일반적으로/tmponunix-likesystemsorc : \ windows \ temponwindows.tocustomizethis : 1) austession_save_path () toSetacustomDirectory, verlyTeCustory-swritation;

toretrievedatafromAphPsession, startSessionstart_start () andaccessvariblesinthe $ _sessionArray.forexample : 1) startthessession : session_start (). 2) retrievedata : $ _ session [ 'username']; echo "Welcome,". $ username;

세션을 사용하여 효율적인 쇼핑 카트 시스템을 구축하는 단계에는 다음이 포함됩니다. 1) 세션의 정의와 기능을 이해합니다. 세션은 요청에 따라 사용자 상태를 유지하는 데 사용되는 서버 측 스토리지 메커니즘입니다. 2) 쇼핑 카트에 제품 추가와 같은 기본 세션 관리를 구현합니다. 3) 제품 수량 관리 및 삭제 지원 고급 사용으로 확장; 4) 세션 데이터를 지속하고 보안 세션 식별자를 사용하여 성능 및 보안을 최적화합니다.

이 기사는 PHP의 인터페이스를 생성, 구현 및 사용하는 방법을 설명하여 코드 구성 및 유지 관리에 대한 이점에 중점을 둡니다.

이 기사에서는 PHP의 암호 해싱에 대한 Crypt ()와 Password_hash ()의 차이점에 대해 논의하여 최신 웹 애플리케이션에 대한 구현, 보안 및 적합성에 중점을 둡니다.

기사는 입력 유효성 검사, 출력 인코딩 및 OWASP ESAPI 및 HTML 청정기와 같은 도구를 통해 PHP의 크로스 사이트 스크립팅 (XSS) 방지에 대해 논의합니다.


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

Video Face Swap
완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

인기 기사

뜨거운 도구

DVWA
DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

안전한 시험 브라우저
안전한 시험 브라우저는 온라인 시험을 안전하게 치르기 위한 보안 브라우저 환경입니다. 이 소프트웨어는 모든 컴퓨터를 안전한 워크스테이션으로 바꿔줍니다. 이는 모든 유틸리티에 대한 액세스를 제어하고 학생들이 승인되지 않은 리소스를 사용하는 것을 방지합니다.

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

드림위버 CS6
시각적 웹 개발 도구

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구
