Download the PHP package storyg/ppcs without Composer

On this page you can find all versions of the php package storyg/ppcs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ppcs

예측 가능한 PHP 코드 스타일

하나의 코드 스타일

PHP는 유지보수가 힘들고 코드가 읽기 어렵다는 선입견이 많다. PHP의 코드 품질이 좋지 못하다는 편견도 많다. 하지만 Laravel과 같은 아름다운 프레임웍이 생기면서 점차 PHP의 입지도 높아졌다. 하지만 이전의 PHP 개발자들은 이전과 같은 스타일로 PHP를 작성하고 있다. 이것이 나쁘다고 하는 것이 아니다. 효율적으로 코드를 작성하려면 어쩔 수 없는 선택일 수도 있다. 하지만 유지보수 및 협업을 위한 코드 스타일이 필요하다고 느낀다. 예측 가능한 PHP 스타일(PPCS)은 유지 보수 하는데 있어서 당신에게 도움을 줄 수 있는 코드 타일이 될 것이다.

변수이름

여기서 이야기 하지 않는 내용들은 일반적인 코드 컨벤션을 따르도록 한다.

멤버변수의 제한자

PHP 객체 멤버 변수는 private 또는 protected로만 지정

ValueObject Trait 사용

PHP에서 가끔 값을 전달하기 위해서 객체 변수를 전달 하는 경우가 있다. 그 전달 한 변수가 변경이 되면 안되는 Value Object일 경우에는 멤버 변수가 변경 되면 안된다. 그렇다고 멤버 변수의 값을 보지 못하게 하는 것도 또한 문제가 된다. 그렇기 때문에 ValueObject Trait를 사용하여 불변 객체로 사용한다. 당신은 당신이 전달한 객체를 변경할 것을 걱정할 필요가 없어진다.

TrustableObj Trait 사용

일반적 코드 스타일 제공

우리는 PHP객체를 사용할 경우 public으로 선언하여 외부에서도 변수에 접근 할 수 있도록 하여 사용한다. 일반적인 PHP에서는 변수를 다음과 같이 사용한다.

우리는 객체의 내장 꺼내기를 방지하기 위해서 멤버 변수를 private 이나 protected로 변경 후 getter를 선언하여 다음과 같이 변경해야 한다.

이러한 코드 스타일은 두가지 이유로 멋지지 않다.

  1. getter와 -> 사실상 의미가 없다.
  2. PHP 멋진 코드 스타일을 버려야 한다.

우리는 의례 getter 선언하고 값을 넘겨주는 데에만 사용한다. getter를 선언하여 값을 가지고 오는 것이나 -> 연산자나 별다른 차이가 없음에도 접근 제한자 때문에 -> 연산자를 사용할 수 없어 코드가 아름답지 못하다.

TrustableObject Trait 를 사용하다면 접근 제한자를 사용하더라도 -> 연산자를 그대로 사용할 수 있다.

외부에서 객체 내부 변수를 변경 못하도록 지원

객체 멤버 변수가 객체 형일때, ->로 호출 했다면 clone를 만들어 넘겨준다.

setter 대신 changer 사용

예측 가능성을 해치는 코드 스타일은 setter 이다. 우리는 의례 setter 를 만들고 관리하지 않는다. 외부에서 내부의 값을 마음대로 변경하는 것을 허용하게 한다. 이런 스타일은 변수를 public으로 선언한 것과 마찬가지이다. 변수 값을 외부에서 변경할 필요가 있다면 setter 대신 changer를 선언하고 변경이 일어날 때 제약 조건을 상세하게 작성한다.

선언 되지 않는 변수 할당 가능

PHP는 예측 가능성을 해치는 문법적 요소를 제공한다.

위의 코드는 weight 라는 선언되지 않은 멤버 변수를 할당할 수 있도록 허용하는 PHP의 기본적 문법을 보여준다. 이런 문법적 요소는 예측 가능성을 해친다. TrustableObj는 이러한 방식으로 예측 가능성을 해치는 코드를 방지한다.


All versions of ppcs with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package storyg/ppcs contains the following files

Loading the files please wait ....